【发布时间】:2020-04-27 11:51:32
【问题描述】:
当我运行npm install nativescript -g 时,我无法使用 npm 安装 nativescript-cli。不知道是什么原因。
节点 --version => 12.16.2
npm --version => 6.14.4
我试过了:
-删除缓存文件夹和npm cache clean --force
-npm config set registry http://registry.npmjs.com
-关闭反恶意软件
但问题仍未解决。
这里是 npm 日志文件输出
11148 warn tar ENOENT: no such file or directory, open 'C:\Users\Mohammad Reza\AppData\Roaming\npm\node_modules\.staging\es5-ext-57d686a6\test\function\invoke.js'
11149 warn tar ENOENT: no such file or directory, open 'C:\Users\Mohammad Reza\AppData\Roaming\npm\node_modules\.staging\es5-ext-57d686a6\function\is-arguments.js'
11150 http fetch GET 200 https://registry.npmjs.org/@sinonjs/commons/-/commons-1.6.0.tgz 22ms (from cache)
11151 verbose unlock done using C:\Users\Mohammad Reza\AppData\Roaming\npm-cache\_locks\staging-60ffea16dce7f1cb.lock for C:\Users\Mohammad Reza\AppData\Roaming\npm\node_modules\.staging
11152 timing stage:rollbackFailedOptional Completed in 2ms
11153 timing stage:runTopLevelLifecycles Completed in 200098ms
11154 warn optional SKIPPING OPTIONAL DEPENDENCY: @types/node@8.10.30 (node_modules\nativescript\node_modules\@types\node):
11155 warn optional SKIPPING OPTIONAL DEPENDENCY: Response timeout while trying to fetch https://registry.npmjs.com/@types%2fnode (over 30000ms)
11156 warn optional SKIPPING OPTIONAL DEPENDENCY: typescript@3.3.4000 (node_modules\nativescript\node_modules\typescript):
11157 warn optional SKIPPING OPTIONAL DEPENDENCY: Response timeout while trying to fetch https://registry.npmjs.com/typescript (over 30000ms)
11158 verbose type body-timeout
11159 verbose stack FetchError: Response timeout while trying to fetch https://registry.npmjs.com/pacote (over 30000ms)
11159 verbose stack at Timeout._onTimeout (C:\Users\Mohammad Reza\AppData\Roaming\npm\node_modules\npm\node_modules\node-fetch-npm\src\body.js:189:16)
11159 verbose stack at listOnTimeout (internal/timers.js:549:17)
11159 verbose stack at processTimers (internal/timers.js:492:7)
11160 verbose cwd C:\Windows\system32
11161 verbose Windows_NT 10.0.18363
11162 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Mohammad Reza\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "nativescript" "-g"
11163 verbose node v12.16.2
11164 verbose npm v6.14.4
11165 error Response timeout while trying to fetch https://registry.npmjs.com/pacote (over 30000ms)
11166 verbose exit [ 1, true ]
【问题讨论】:
-
想必您已经尝试将注册表设置为
https而不是http,即运行npm config set registry https://registry.npmjs.org/?或者类似地运行npm config delete registry将其设置回默认注册表,即https://registry.npmjs.org/? -
是的,我都测试过,但我得到了相同的结果@RobC
-
可能与
pacote的issue #38有关。
标签: node.js npm nativescript