Npm Please try using this command again as root/administrator

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

    What helped me on Windows 10 was just ticking off "Read Only" of project node_modules.

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

    I had to login into npm to resolve this issue.

    npm login

    0 讨论(0)
  • 2020-12-02 07:00

    If you are doing this on mac type: sudo chown -R $USER /usr/local that will give you administrative access to your files

    0 讨论(0)
  • 2020-12-02 07:01

    $ npm cache clean
    npm ERR! As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead.

    I tried running npm cache verify with admin rights and it worked after that.

    0 讨论(0)
  • 2020-12-02 07:02

    You should run cmd.exe as administrator.

    Follow the following steps:

    • Click Start, click All Programs, and then click Accessories.
    • Right-click Command prompt, and then click Run as administrator.
    0 讨论(0)
  • 2020-12-02 07:02

    I don't know which steps worked for me. But these are my steps to get rid of this error:

    1. Updated Node.js
    2. Ran npm cache clean command in Command prompt ( With some element of doubt for cache presence)
    3. Ran react-native init in command prompt as Administrator (on Windows OS), hoping works well with sudo react-native init on Mac OS
    0 讨论(0)
提交回复
热议问题