This command fix the issue. It worked for me:
sudo npm install -g --unsafe-perm=true --allow-root
I have same issue with webpack server installation on globally, Use steps from this Url Solved my issue, my be work for you.
Steps mention above There: Back-up your computer before you start.
Make a directory for global installations:
1.
mkdir ~/.npm-global
Configure npm to use the new directory path:
2.
npm config set prefix '~/.npm-global'
Open or create a ~/.profile file and add this line:
3.
export PATH=~/.npm-global/bin:$PATH
Back on the command line, update your system variables:
4.
source ~/.profile
Test: Download a package globally without using sudo.
npm install -g jshint
Instead of steps 2-4, you can use the corresponding ENV variable (e.g. if you don't want to modify ~/.profile):
NPM_CONFIG_PREFIX=~/.npm-global
I had problem on Linux. I wrote
chown -R myUserName /home/myusername/myfolder
in my project folder.
WARNING: this is NOT the right way to fix it; DO NOT RUN IT, if you aren't sure of what could be the consequences.
Creating package.json using npm init solved my issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With