Npm Please try using this command again as root/administrator

后端 未结 30 871
旧巷少年郎
旧巷少年郎 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条回答
  •  悲&欢浪女
    2020-12-02 06:51

    Deleting the global npm-cache and/or running my cmd line as admin did not work for me. Also, as of npm version 5.x.x, it supposedly recovers from cache corruption by itself.

    This did work:

    1. Deleted the node_modules folder in my current project.

    2. Deleted the package-lock.json in my current project

    3. Installed the new package. In my case: npm install bootstrap@next --save

    4. Ran npm install for my current project.

    Everything now works. In general, nuking node_modules and package-lock.json usually fix these "no apparent reason" bugs for me.

    EDIT

    I just had the same problem again. But I noticed that everything was installed correctly even though it threw the error after I had followed the steps outlined above. So I could just run ng serve (for Angular), and everything worked.

    This sure is a weird error...

提交回复
热议问题