Npm Please try using this command again as root/administrator

后端 未结 30 847
旧巷少年郎
旧巷少年郎 2020-12-02 06:38

I\'ve been desperately trying to install modules using node.js but it always fails getting packages with npm.

I logged in as Administrator and used powershell/cmd wi

30条回答
  •  Happy的楠姐
    2020-12-02 06:57

    I messed with this problem 2 times and tried all suggestions here with mediocre success.

    • First time I tried (and succeeded luckily) by:

      1. delete the node_modules folder in your project

      2. npm clean cache -f

      3. check your %APPDATA%/npm-cache and delete everything if not empty

      4. start the terminal as administrator (in my opinion, it isnt a problem of rights, but it wont hurt if you do so)

      5. npm install and then npm update

      6. you will get errors, just install every module that throws an error manually and step by step try to eliminate everything whats wrong

    However, this method is quite frustrating and not working everytime. So try this:

    • Second time I had no luck with the steps above, so I tried to completely reinstall npm and it failed. So I thought there must something be wrong with my node.js installation. My team is running 6.10. and I had the 6.11. and tried it with the 6.10. with no luck.

      1. So I completely wiped everything off my system. Deleted all node modules, checked every path where node or npm could be and cleaned my system.

      2. Then I installed newest 8.1.3

      3. Deleted my project and cloned it to a complete different directory.

      4. Now I installed and updated everything with npm install npm update

      5. Then I compiled with just 2 modules missing and installed them manually

    Tadaaaaa, its working now. So all in all it was a problem with node.js. I recommend to everyone who runs into this problem: Try different node versions! And clean ABSOLUTE everything.

提交回复
热议问题