简体   繁体   English

“npm install”挂在窗台上:idealTree build

[英]"npm install" hangs on sill: idealTree build

I've been trying to solve this over the last two days, or so, with no effect:在过去两天左右的时间里,我一直在尝试解决这个问题,但没有效果:

在此处输入图像描述

Solution that I have attempted include:我尝试过的解决方案包括:

  • Deleting the package-lock.json file删除 package-lock.json 文件
  • Coordinating with the other dev on the project to align the Node.js version and reinstalling the whole framework与项目的其他开发人员协调以调整 Node.js 版本并重新安装整个框架
  • Using --verbose as part of the "ndm i" command使用 --verbose 作为“ndm i”命令的一部分
  • Editing environmental variables to add NPM to them编辑环境变量以向其添加 NPM
  • Deleting the "node_modules" folder删除“node_modules”文件夹
  • Disabling, then re-enabling SSH禁用,然后重新启用 SSH
  • Trying with and without VPN being active尝试启用和不启用 VPN
  • Clearing the cache via the command line, ie the node_modules step above通过命令行清除缓存,即上面的node_modules步骤

This is a link to another topic on the same issue on SO that also seems to be outstanding: Link这是指向 SO 上同一问题的另一个主题的链接,该主题似乎也很出色: Link

I've reviewed the range of discussions on SO about the problem, to no particular avail, and I think I'm out of options.我已经审查了有关该问题的 SO 讨论范围,但无济于事,而且我认为我别无选择。 Any insight is appreciated任何见解表示赞赏

On MacOS (M1 chip) switching the IPV6 from Automatically to Link-local only fixed a very similar issue.在 MacOS(M1 芯片)上,将 IPV6 从Automatically切换到Link-local only解决了一个非常相似的问题。 When I tried adding registry.npmjs.org , npm was similarly getting "stuck".当我尝试添加registry.npmjs.org时,npm 同样“卡住了”。

To apply this setting go to System Preferences >> Network >> press Advanced >> TCP/IP tab >> on Configure IPv6 select Link-local only and apply要应用此设置,请转到System Preferences >> Network >> 按Advanced >> TCP/IP选项卡 >> 在Configure IPv6上选择Link-local only并应用

I found this solution in this thread我在 这个线程中找到了这个解决方案

The issue was the connection to registry.npmjs.org, after the installation attempt finally processed.问题是在安装尝试最终处理后与 registry.npmjs.org 的连接。

在此处输入图像描述

The solution is that when you go to run "npm install", you have to add "registry.npmjs.org" at the end of it, and it sums up to:解决方法是,当你 go 运行“npm install”时,你必须在它的末尾添加“registry.npmjs.org”,它总结为:

npm i registry.npmjs.org npm i registry.npmjs.org

Make sure to run this from the folder of your NodeJS project.确保从您的 NodeJS 项目的文件夹中运行它。

Other useful links to consult:其他有用的参考链接:

NPM stuck on idealTree: timing idealTree NPM 卡在理想树上:定时理想树

npm install hangs npm 安装挂起

stop "npm install" at [..................] | 在 [.....................] 处停止“npm install” | idealTree:regal: sill idealTree buildDeps 理想树:富豪:窗台理想树构建Deps

Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443 --this one is for Angular, but still relevant. 错误:getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443——这个是针对 Angular,但仍然相关。

As a final curiosity, going to registry.npmjs.org leads to this site:作为最后的好奇心,去 registry.npmjs.org 会导致这个网站: 在此处输入图像描述

where as https://www.npmjs.com/package/registry.npmjs.org leads to其中https://www.npmjs.com/package/registry.npmjs.org导致

在此处输入图像描述

You will note the command I used in this solution on the right side of that last screenshot.您将在最后一个屏幕截图的右侧注意到我在此解决方案中使用的命令。

Finally:最后: 在此处输入图像描述

There is a typo in the error output: error refers to "registry.n PJM s.org", whereas the address has to be "registry.n PMJ s.org".错误 output 中有错字:错误是指“registry.n PJM s.org”,而地址必须是“registry.n PMJ s.org”。 I don't know if this should be brought to the attention of NodeJS devs, but there you go.我不知道这是否应该引起 NodeJS 开发人员的注意,但是你有 go。

Add the following to node\node_modules\npm\.npmrc :将以下内容添加到node\node_modules\npm\.npmrc

strict-ssl=false

See How to install NodeJS LTS on Windows as a local user (without admin rights) for details.有关详细信息,请参阅如何以本地用户(无管理员权限)在 Windows 上安装 NodeJS LTS

One more thing that might cause this is if you have incorrectly formatted certificates added to your npm config.可能导致这种情况的另一件事是,如果您在 npm 配置中添加了格式不正确的证书。

To check if this is a problem you can run要检查这是否是您可以运行的问题

npm config get cert
npm config get key

To check if there is a value there, and if they look right.检查那里是否有值,以及它们看起来是否正确。

If you're not sure, make a note of the values so you can restore if necessary and then remove them from the config如果您不确定,请记下这些值,以便您可以在必要时恢复,然后从配置中删除它们

npm config delete cert
npm config delete key

Then try npm install again然后再次尝试 npm install

To add the config back use要重新添加配置,请使用

npm config set cert "<cert>"
npm config set key "<key>"

substituting you actual cert and key, (not the file, but the cert and key text) more info on npm config here https://docs.npmjs.com/cli/v8/using-npm/config#cert替换你实际的证书和密钥,(不是文件,而是证书和密钥文本)关于 npm 配置的更多信息在这里https://docs.npmjs.com/cli/v8/using-npm/config#cert

In my case, it was a weird internet connection problem.就我而言,这是一个奇怪的互联网连接问题。 I tried to use a 4G sharing with my phone and tried to run npm install again, it worked.我尝试使用 4G 共享与我的手机并尝试再次运行 npm install,它成功了。 This way I was sure the problem was related to my connection set up and not node installation.这样我就确定问题与我的连接设置有关,而不是节点安装。

I unplugged my ethernet cable for 20s, plugged it in again and it worked, surprisingly.我拔掉了我的以太网电缆 20 秒,然后再次插入它并且它起作用了,令人惊讶。

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

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