Npm Please try using this command again as root/administrator

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

    Here is how I fixed the problem in Windows. I was trying to install the CLI for Angular.

    1. Turn off firewall and antivirus protections.

    2. Right click the nodejs folder (under Program Files), select Properties (scroll all the way down), click the Security tab, and click all items in the ALLOW column (for All System Packages and any user or group that allows you to add the “allow” checkmark).

    3. Click the Windows icon. Type cmd. Right click the top result and select Run as Administrator. A command window results.

    4. Type npm cache clean. If there is an error, close log files or anything open and rerun.

    5. Type npm install -g @angular/cli (Or whatever npm install command you are using)

    6. Check the installation by typing ng –version (Or whatever you need to verify your install)

    Good luck! Note: If you are still having problems, check the Path in Environmental Variables. (To access: Control Panel → System and Security → System → Advanced system settings → Environment variables.) My path variable included the following: C:\Users\Michele\AppData\Roaming\npm

提交回复
热议问题