简体   繁体   English

npm install -g @ angular / cli无法正常工作并挂在Windows 7中

[英]npm install -g @angular/cli not working and hanging in windows 7

I am unable to install the angular cli from the npm and its getting stuck asking to loadAllDepsIntoIdealTree. 我无法从npm安装角度cli及其卡住,要求加载loadAllDepsIntoIdealTree。

Steps taken: 采取的步骤:

C:\\Windows\\system32\\node -v C:\\ Windows \\ system32 \\ node -v

v6.11.1 v6.11.1

C:\\Windows\\system32\\npm -v C:\\ Windows \\ system32 \\ npm -v

3.10.10 3.10.10

C:\\Windows\\system32\\npm install -g @angular/cli C:\\ Windows \\ system32 \\ npm安装-g @ angular / cli

Its gets stuck with the attached error 它被附加的错误卡住了

在此处输入图片说明

I also stucked in the same problem. 我也陷入了同样的问题。 Below solution works for me. 下面的解决方案为我工作。

It would be better if you upgrade your node and npm versions to latest. 如果将nodenpm版本升级到最新版本会更好。 After that please follow the below steps to install the angular/cli : 之后,请按照以下步骤安装angular/cli

Open your command prompt with administrative privileges and uninstall angular/cli by using npm uninstall -g angular-cli command. 使用管理特权打开命令提示符,然后使用npm uninstall -g angular-cli命令卸载angular/cli

Remove node_modules directory and then clear the cache by using npm cache clear --force command. 删除node_modules目录,然后使用npm cache clear --force命令npm cache clear --force

Remove C:\\Users\\<username>\\AppData\\Roaming\\npm\\ and C:\\Users\\<username>\\AppData\\Roaming\\npm-cache . 删除C:\\Users\\<username>\\AppData\\Roaming\\npm\\C:\\Users\\<username>\\AppData\\Roaming\\npm-cache

Try to install the angular/cli@latest by using npm install -g @angular/cli@latest command. 尝试安装angular/cli@latest通过npm install -g @angular/cli@latest命令。

Hope the above trick resolve your issue. 希望以上技巧能解决您的问题。

I had the same problem for npm@5.3.0 on macOS . 我在macOS npm@5.3.0遇到了同样的问题。 It was resolved by checking my package.json file with validator . 通过使用validator检查我的package.json文件来解决此问题。

In my case the problem was the git package version notation: gulpjs/gulp.git#4.0 instead of https://github.com/gulpjs/gulp.git#4.0 . 就我而言,问题是git软件包的版本符号: gulpjs/gulp.git#4.0而不是https://github.com/gulpjs/gulp.git#4.0

After changes I also regenerate package-lock.json . 更改之后,我还重新生成package-lock.json

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM