运行windows 7 Professional 32bit。

我试着在normal或admin下运行npm install -g angular-cli。

我还尝试将它添加到PATH: (C:\Users\Administrator\AppData\Roaming\npm\node_modules\angular-cli\bin\ng)下的环境变量中,也没有成功。

我做错了什么?


当前回答

与其使用内置的命令提示符,不如开始使用NodeJS安装版本的命令提示符。然后它将完美地工作,没有任何问题。

其他回答

今天我也遇到了同样的问题,我走过了下面这条路—— (%USERPROFILE%\AppData\Roaming\npm),当我清除npm目录下的所有内容时,才知道有一些垃圾数据。现在当我运行(npm安装命令再次)。现在一切正常。

我在Windows 7上也遇到了同样的问题,64位运行npm v3.10.8。

我按照建议添加了路径:(C:\Users.....(你的用户名)\AppData\Roaming\npm\node_modules\angular-cli\bin\ng)和卸载angular-cli。 在这之后,我清除npm缓存通过npm缓存清理提示这里https://blogs.msdn.microsoft.com/matt-harrington/2012/02/23/how-to-fix-node-js-npm-permission-problems/。这保证了没有剩菜。 用npm install -g angular-cli重新安装angular-cli,瞧。 希望对大家有用!

安装x32版本的nodejs而不是x64版本(即使在64位windows机器上)。

将C:\Users\DELL\AppData\Roaming\npm添加到系统变量路径对我来说很有效。请找到相应的“npm”文件路径

另外,检查是否已经将angular-cli\bin路径添加到path变量中。

我必须将npm路径添加到user path环境变量中。你可以以管理员身份运行以下PowerShell脚本:

$path = npm config get prefix    
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")

if (($userPath -split ';') -notcontains $path) 
{
    [Environment]::SetEnvironmentVariable("PATH", ('{0};{1}' -f $userPath, $path), "User")
}