运行 npm 命令时出错 [英] Error running npm command

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

问题描述

我已经安装了 node.js但在命令提示符下未识别 npm 命令.我也设置了环境变量.请帮帮我.

I have installed node.js But in command prompt npm command is not identified. I have set environmental variable also. Kindly help me out.

这是命令提示符下的响应:

This is the response in command prompt:

C:\Users\593180.INDIA>npm
URIError: URI malformed
at decodeURIComponent (native)
at Url.parse (url.js:179:19)
at Object.urlParse [as parse] (url.js:101:5)
at Object.validateUrl [as validate] (C:\Program Files (x86)\nodejs\node_modu
les\npm\node_modules\nopt\lib\nopt.js:157:13)
at validate (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\nop
t\lib\nopt.js:205:24)
at validate (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\nop
t\lib\nopt.js:172:11)
at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\nopt\lib\nopt
.js:101:12
at Array.map (native)
at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\nopt\lib\nopt
.js:67:15
at Array.forEach (native)
C:\Program Files (x86)\nodejs\node_modules\npm\lib\npm.js:37
throw new Error('npm.load() required')
      ^
Error: npm.load() required
at Object.npm.config.get (C:\Program Files (x86)\nodejs\node_modules\npm\lib
\npm.js:37:11)
at exit (C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils\error-hand
ler.js:49:27)
at process.errorHandler (C:\Program Files (x86)\nodejs\node_modules\npm\lib\
utils\error-handler.js:314:3)
at process.EventEmitter.emit (events.js:95:17)
at process._fatalException (node.js:272:26)

推荐答案

您可能通过配置代理或其他 URL 破坏了 npm

You probably broke npm by configuring your proxy or other URL

进入您的用户文件夹

C:\用户\用户名

编辑文件.npmrc"

edit the file ".npmrc"

并修复您的代理网址或其他损坏的网址proxy = http://login:password@proxyaddress:port

and fix your proxy url or other corrupted url proxy = http://login:password@proxyaddress:port

这篇关于运行 npm 命令时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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