简体   繁体   English

npm命令不起作用

[英]npm commands not work

No npm command (all!) is working on my Windows 10. Windows 10上没有npm命令(全部!)。

Example: 例:

npm -v npm -v

It does not display any information and cmd crashes. 它不显示任何信息,cmd崩溃。 Only unlocks if I hit CTR + C and inform "Y": 仅在我点击CTR + C并告知“ Y”时才解锁:

在此处输入图片说明

I've tried reinstalling node.js (v6.6.0 x64 and v5.12.0 x86), tried npm versions v3.10.3 and v3.10.7, but all without success. 我尝试重新安装node.js(v6.6.0 x64和v5.12.0 x86),尝试使用npm版本v3.10.3和v3.10.7,但都没有成功。

How can I fix it? 我该如何解决?

NEWS: 新闻:

My conf.get('prefix') in afterUser() function on nodejs\\node_modules\\npm\\lib\\config\\core.js it is returning the wrong directory: C:\\Users\\Alisson Linneker\\'C:\\Program 我在nodejs\\node_modules\\npm\\lib\\config\\core.js上的afterUser()函数中的conf.get('prefix')返回错误的目录: C:\\Users\\Alisson Linneker\\'C:\\Program

I believe that this is the problem! 相信这就是问题所在!

Problem solved! 问题解决了!

In nodejs\\node_modules\\npm\\lib\\config\\core.js afterUser() function, add before if (conf.get('prefix')) { line: nodejs\\node_modules\\npm\\lib\\config\\core.js afterUser()函数中,在if (conf.get('prefix')) {之前添加:

conf.set('prefix', path.resolve(__dirname, '../..', ''))

For Windows I use Virtual Box with Ubuntu. 对于Windows,我将Virtual Box与Ubuntu一起使用。 If you set that up you will have an easier time. 如果您进行了设置,您将拥有更轻松的时间。

In nodejs\\node_modules\\npm\\lib\\config\\core.js afterUser() function, add before if (conf.get('prefix')) { line: nodejs\\node_modules\\npm\\lib\\config\\core.js afterUser()函数中,在if (conf.get('prefix')) {之前添加:

conf.set('prefix', path.resolve(__dirname, '../..', ''))

Pull request: https://github.com/npm/npm/pull/13995 拉取请求: https : //github.com/npm/npm/pull/13995

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

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