node.js - 尝试获取 https ://registry. npmjs.com/pacote 时响应超时

标签 node.js npm nativescript

当我运行npm install nativescript -g时,我无法使用npm安装nativescript-cli。不知道是什么原因。 Node --version => 12.16.2
npm --version => 6.14.4

我尝试过:
-删除缓存文件夹和npm cache clean --force
-npm 配置集注册表 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/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="610f0e050421594f50514f5251" rel="noreferrer noopener nofollow">[email protected]</a> (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: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="12666b62776171607b626652213c213c26222222" rel="noreferrer noopener nofollow">[email protected]</a> (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 ]

最佳答案

我遇到了同样的问题,这似乎是 npm 的问题版本 6.14.* 。降级至<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="68061805285e46595b4659" rel="noreferrer noopener nofollow">[email protected]</a>为我工作。

npm i <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3658465b76001807051807" rel="noreferrer noopener nofollow">[email protected]</a> -g

关于node.js - 尝试获取 https ://registry. npmjs.com/pacote 时响应超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61458251/

相关文章:

node.js - Gulp build 不会自动安装依赖项?

javascript - NativeScript 中的 Paho MQTT

android - NativeScript Vue + FaSTLane - 自定义 iOS/Android 项目路径?

android - 向 Bluemix 部署的 Node.js 应用程序发送 httppost 请求时出现 "Unfortunately app has stopped"错误

node.js - 用于目录多语言应用程序的 Angular SEO

node.js - 在亚马逊ec2中的端口80上提供 Node Web应用程序

angular - npm run 不通过 --configuration 来构建任务

node.js - npm 错误!缺少脚本 : start error with Docker

ruby-on-rails - 尝试连接到 Actioncable 服务器时出现 websocket 错误代码 1006

node.js - 对 MongoDb 数据库执行操作时页面挂起