node.js - 运行命令 npm install -g @angular\cli 后,我收到一个 npm ERR!编码 ENOLOCAL

标签 node.js angular npm command-line-interface

我最初使用运行 Windows 10 的计算机和另一台运行 Windows 8.1 的计算机,但我仍然在两台计算机上收到相同的消息。错误日志为:

npm ERR! code ENOLOCAL
npm ERR! Could not install from "@angular\cli" as it does not contain a package.json file.

node和npm版本分别是8.2.1和5.3.0。

当我在 git bash 上运行命令时,我收到一条不同的错误消息。错误日志为:

npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "@angularcli": Tags may not have any characters that encodeURIComponent encodes.

最佳答案

你的命令是错误的:

它是 @angular/cli 带有正斜杠而不是 @angular\cli

npm install -g @angular/cli

为了在 windows 上安装 angular-cli

npm install -g @angular/cli 代替 npm install –g @angular-cli

关于node.js - 运行命令 npm install -g @angular\cli 后,我收到一个 npm ERR!编码 ENOLOCAL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45544104/

相关文章:

node.js - 为什么在node js的可读事件中read(1)函数调用两次?

angular - 如何上传CSV并以UTF-8编码显示?

angular - 如何在 Angular Testing 中向特定测试用例注入(inject)另一个服务

javascript - 如何将 angular2 组件附加到 d3 选择?

angularjs - 在 Linux 上安装 NPM

angularjs - 如何仅安装 angular-ui-router.js 文件而不是 npm 的整个源代码解决方案?

php - Node.js , Socket.io 从子域访问 cookie 数据

node.js - Mongoose 首先按一个属性排序和限制,然后按另一个属性排序

node.js - 为预安装运行的 npm 脚本,但不为预更新运行

javascript - 为 Firebase 云功能启用 Cors