npm 挂在任何命令上 [英] npm hangs on any command

查看:43
本文介绍了npm 挂在任何命令上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了最新版本的 Node.js (12.2 x64 windows)在我以管理员身份运行 cmd 并尝试调用任何 npm 命令(npm -v 除外)后,cmd 窗口挂起.Ctrl+C 后返回

<块引用>

终止批处理作业(是/否)?

我试图离开 cmd 几个小时,但它没有给出一些结果.这很奇怪,因为 node.exe 进程非常消耗 CPU 和内存.

我多次尝试重新安装 node.js,但没有成功.
我什至无法获得一些调试信息.

我在通过 rdp 连接使用的 VM 上遇到了这样的问题.安装在我的笔记本电脑上的相同版本工作正常.在我的 VM 上,我安装了卡巴斯基防病毒软件,但在关闭后我得到了相同的结果.

有人遇到过这样的问题吗?有没有办法获得更多的信息问题?你能推荐我一些解决方法吗?

解决方案

我终于解决了我的问题.根据我们本地自述文件的建议

<块引用>

Node.js (with NPM) 注意:在 Windows 服务器机器上,节点模块安装在用户 %APPDATA% 路径,而不是安装在全局路径,例如 c:\npm.这可以通过 npm 命令来实现: $ npm config set prefix 'c:\npm' 这在个别开发者的机器上不是必需的.

我已经执行了 npm config set prefix 'c:\npm'.

结果它添加了 prefix="'c:\\npm'" 到我的 .npmrc 文件

这让 node.js 真的很疯狂.我花了大约一个小时来调试所有这些 js 脚本 npm.js code.js 等......发现它调用了 mkdirp'c:\\npm'\etc 并且它永远循环过程.

I installed last version of Node.js (12.2 x64 windows) After I run cmd as administrator and try to call any npm command (except npm -v), cmd window is hanging. After Ctrl+C it returns

Terminate batch job (Y/N)?

I was trying to left cmd for several hours but it didn't give some results. It is strange because node.exe process is consuming CPU and memory quite hard.

I was trying to reinstall node.js several times without success.
I can't even get some debug information.

I faced such issue on my VM which I was using by connecting via rdp. Same version installed on my laptop works ok. On my VM I had Kaspersky antivirus, but after switching it off I got same result.

Did somebody face such issue? Is there some way to get more information problem? Could you please recommend me some way to resolve?

解决方案

I've finally resolved my issue. According to suggestion from our local read me file

Node.js (with NPM) Note: On windows server machines, instead of node modules been installed at user %APPDATA% path, its better to install at a global path e.g c:\npm. This could be acheived by the npm command: $ npm config set prefix 'c:\npm' This is not required on individual developer's machine.

I've executed npm config set prefix 'c:\npm'.

As result it added prefix="'c:\\npm'" to my .npmrc file

This make node.js really crazy. It takes me about an hour to debug all these js scripts npm.js code.js etc... to find that it calls mkdirp with 'c:\\npm'\etc and it loop process forever.

这篇关于npm 挂在任何命令上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆