运行windows 7 Professional 32bit。

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

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

我做错了什么?


当前回答

在系统env设置中,将node_modules下的.bin文件夹中的ng命令路径添加到path变量。

例:将C:\testProject\node_modules\.bin\添加到PATH中

重新启动IDE。

其他回答

只需打开命令提示符(以管理员身份运行)。确保node——v高于6.9.0,npm——v高于3.0.0 r。

然后执行以下命令:

npm install -g @angular/cli

一旦安装了angular。你可以在路径中看到angular cli的条目

C:\Users\Dell\AppData\Roaming\npm\node_modules\@angular

那就试着帮忙。它会起作用的。

我根据图解决了这个问题:

在CMD下运行

 npm install -g @angular/cli

然后

(在Windows 10中打开)控制面板\所有控制面板项\系统 或按图

步骤1:

第二步:

步骤3:

目的:

添加缺少的ng路径

下面是你需要添加的新环境变量:c:\ users \ pk\ appdata \漫游\npm\node_modules\@angular\cli\bin

最后,重新启动所有打开的命令提示符并重试。

我必须将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")
}

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

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