问题
I was suddenly having an issue in my project like this. It was repeated and crashed my chrome:
So, I downgraded some of my packages and I downgraded my npm to 6.6.0 which was stable for my project. The main problem started after that. I removed the node_modules folder and when I tried to
sudo npm install
[because npm install
says permission issue]
it started showing these errors:
npm info it worked if it ends with ok npm verb cli [ '/usr/bin/node', npm verb cli '/data/data/com.termux/files/usr/bin/npm', npm verb cli 'i', npm verb cli '-g', npm verb cli 'npm', npm verb cli
'--verbose' ] npm info using npm@6.6.0 npm info using node@v10.15.0 npm verb npm-session 3b7ba2a77f7e848c Unhandled rejection Error: EACCES: permission denied, link '/home/.npm/_cacache/tmp/6a547224' -> '/home/.npm/_cacache/content-v2/sha512/d8/e0/f8cb9554c1f6f974b32fe943e4df8353fca3cb4843dbeda6fe0d88d14eb91bec5d23ddde1751af76721044d662b479ec4c9df9f0bfcce592bbc9fc2b6f72' at Error (native)npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at: npm ERR! https://github.com/npm/npm/issues
npm ERR! A complete log of this run can be found in: npm ERR!
/home/.npm/_logs/2017-06-28T00_20_47_543Z-debug.log
I have also tried npm cache clear -f
and also tried to install npm install --no-cache
But it was having problem with npm install and somehow I was getting the previous build.
回答1:
I have solved this issue by changing the permission level of my user. This was an issue because in ubuntu the node_modules folder had by default root folder permission. I have checked this by this command:
in my project folder: ls -la
So I got a whole list where I have seen the permission for node_modules was like this:
drwxrwsrwx 906 root www-data 36864 মে 14 16:17 node_modules
-rw-r--r-- 1 my_username www-data 2407 মে 14 16:14 package.json
But my user didn't have the permission to write. So what I did is:
sudo chown -R my_username:my_username node_modules/
It solved my problem.
来源:https://stackoverflow.com/questions/56143742/issue-with-webpack-and-npm-package-installation-in-ubuntu