Npm Please try using this command again as root/administrator

后端 未结 30 721
旧巷少年郎
旧巷少年郎 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:46

    Try following steps

    1. Run this command on Terminal or CMD - npm cache clean

    2. Go to this folder on windows %APPDATA%\npm-cache And delete folder which you want to install module (Ex:- laravel-elixir) or if you are using PowerShell, $env:APPDATA\npm-cache

    3. Then Run your command EX:- npm install laravel-elixir

    0 讨论(0)
  • 2020-12-02 06:46

    As my last resort with this error I created a fresh windows 10 virtual machine and installed the latest nodejs (v6). But there was a host of other "ERRs!" to work through.

    I had to run npm cache clean --force which ironically will give you a message that reads "I sure hope you know what you are doing". That seems to have worked.

    It doesn't solve the issue on my main Dev machine. I'm canning nodejs as I found over the last few years that you spend more time on fixing it rather than on actual development. I had fewer issues with node on linux ubuntu 14.04 if that's any help.

    0 讨论(0)
  • 2020-12-02 06:46

    This worked for me, if your package.json is not too big you can do this:

    • Signout then signin.
    • Delete node_modules.
    • npm install again.
    0 讨论(0)
  • 2020-12-02 06:47

    I solve it running as administrator cmd. Cleaning the cache npm cache clean -f And then try to install the package again

    0 讨论(0)
  • 2020-12-02 06:48

    If you're using TFS or any other source control for your project that sets your checked in files to readonly mode, then you gotta make sure package.json is checked out before running npm install. I've made this mistake plenty of times.

    0 讨论(0)
  • 2020-12-02 06:48

    npm cache verify

    Try for newer versions of npm.

    I'm using v 5.5.1 and it's working fine.

    0 讨论(0)
提交回复
热议问题