【发布时间】:2019-10-16 07:45:26
【问题描述】:
我一直在尝试在我的 Windows 系统上安装 Angular CLI。
我是新手,并且一直按照https://angular-templates.io/tutorials/about/learn-angular-from-scratch-step-by-step 中给出的步骤来设置我的环境。由于我使用的是 Windows,所以我使用“nodist”NVM 方法在我的系统上安装 node 和 npm。我可以成功运行这两个命令,暗示 npm 和 node 可能已正确安装 -
C:\WINDOWS\system32>npm -v
1.2.24
C:\WINDOWS\system32>node -v
v0.10.9
现在,为了安装 Angular CLI,我运行了 -
C:\WINDOWS\system32>npm install -g @angular/cli
npm ERR! addLocal Could not install angular/cli
npm ERR! Error: ENOENT, stat 'C:\WINDOWS\system32\angular\cli'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "@angular/cli"
npm ERR! cwd C:\WINDOWS\system32
npm ERR! node -v v0.10.9
npm ERR! npm -v 1.2.24
npm ERR! path C:\WINDOWS\system32\angular\cli
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\WINDOWS\system32\npm-debug.log
npm ERR! not ok code 0
我尝试创建一个文件夹“C:\WINDOWS\system32\angular\cli”。另外,尝试清理缓存并重试。但这些都没有帮助。
编辑:
好的,我尝试通过其中一个 cmets 中提到的安装程序文件进行设置,现在我有了节点版本 - “10.16.3”和 npm 版本 - “6.9.0”。 但是运行上述安装 angular-cli 的命令会给我这个错误:
C:\WINDOWS\system32>npm i -g @angular/cli
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! FetchError: request to http://registry.npmjs.org/@angular%2fcli failed, reason: connect ECONNREFUSED 104.16.18.35:80
npm ERR! at ClientRequest.req.on.err (C:\Users\comviva\AppData\Roaming\nvm\v0.10.9\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
npm ERR! at ClientRequest.emit (events.js:198:13)
npm ERR! at Socket.socketErrorListener (_http_client.js:392:9)
npm ERR! at Socket.emit (events.js:198:13)
npm ERR! at emitErrorNT (internal/streams/destroy.js:91:8)
npm ERR! at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
npm ERR! at process._tickCallback (internal/process/next_tick.js:63:19)
另外,我在办公室使用了一个系统。在 Windows 上的“更改代理设置”中查找代理设置,我没有看到正在使用任何代理服务器。
【问题讨论】:
-
升级你的节点和 npm 版本
-
npm install -g npm@latest
-
@AhmedRebai 运行此命令时出现此错误:npm ERR!错误:连接 ECONNREFUSED npm ERR!在 errnoException (net.js:884:11) npm ERR!在 Object.afterConnect [as oncomplete] (net.js:875:19) npm ERR! { [错误:连接 ECONNREFUSED] npm 错误!代码:'ECONNREFUSED',npm 错误!错误号:'ECONNREFUSED',npm 错误!系统调用:“连接”}
标签: angular npm angular-cli nvm nodist