简体   繁体   中英

npm commands not work

No npm command (all!) is working on my Windows 10.

Example:

npm -v

It does not display any information and cmd crashes. Only unlocks if I hit CTR + C and inform "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.

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

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:

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

For Windows I use Virtual Box with 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:

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

Pull request: https://github.com/npm/npm/pull/13995

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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