node.js - 配置后无法使用 "cmd"命令安装bower和yeoman

标签 node.js npm yeoman bower-install

当我尝试从 npmjs 站点安装 Bower 或 yeoman 时,我的“cmd”命令就像通过此错误一样。这是错误:

D:\bow>npm install -g yo grunt-cli bower
npm http GET https://registry.npmjs.org/yo
npm http GET https://registry.npmjs.org/grunt-cli
npm http GET https://registry.npmjs.org/bower
npm http GET https://registry.npmjs.org/yo
npm http GET https://registry.npmjs.org/grunt-cli
npm http GET https://registry.npmjs.org/bower
npm http GET https://registry.npmjs.org/yo
npm http GET https://registry.npmjs.org/grunt-cli
npm http GET https://registry.npmjs.org/bower
npm ERR! network tunneling socket could not be established, cause=getaddrinfo EN
OTFOUND
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settin
gs.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "yo" "grunt-cli" "bower"

npm ERR! cwd D:\bow
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ECONNRESET
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     D:\bow\npm-debug.log
npm ERR! not ok code 0

我的用户名是“mb112830”,密码是“TECHM@112830”,我的服务器是“msat”,端口是80,所以,要检查我的npm的配置,它显示如下:

D:\bow>npm help config

D:\bow>npm config list
; cli configs
registry = "https://registry.npmjs.org/"

; userconfig C:\Users\mb112830\.npmrc
https-proxy = "http://mb112830:TECHM%40112830@msat:80/"
proxy = "http://mb112830:TECHM%40112830@msat:80/"
regisry = "http://registry.npmjs.org/"

; builtin config undefined
prefix = "C:\\Users\\mb112830\\AppData\\Roaming\\npm"

; node bin location = C:\Program Files\nodejs\\node.exe
; cwd = D:\bow
; HOME = C:\Users\mb302811
; 'npm config ls -l' to show all defaults.

全部正确。我也将环境变量设置为我的计算机属性。我还需要做什么来直接使用“cmd”命令检查 npm 模块?

有人可以帮我解决这个问题吗?如果发现任何错误,请突出显示。

提前致谢!

这是我的“.npmrc”文件包含的信息

    proxy = http://"mb302811:TECHM@302811"@msat:80/
    https-proxy = http://"mb302811:TECHM@302811"@msat:80/
    registry = http://registry.npmjs.org/

谢谢。

最佳答案

问题似乎是由于您的密码中的“@”造成的。
尝试在用户名和密码周围使用“引号”。

npm config set proxy http://"user:p@ss"@proxy:port

关于node.js - 配置后无法使用 "cmd"命令安装bower和yeoman,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23779535/

相关文章:

javascript - Mocha 测试失败无法执行异步功能

node.js - yeoman angular generator 不会启动 grunt serve

javascript - 如何使用自定义查询方法延长水线?

node.js - 导入publishsettings文件时azure-cli返回错误

reactjs - 无法使用 npm run build 构建 React 应用程序 - 退出状态 1

windows - git被阻塞,如何安装npm模块

reactjs - 如何在 fork 库中使用 DefinetelyTyped?

node.js - NPM:运行 npm 时未找到 npm-cli.js

javascript - 将 grunt-usemin 与动态生成的图像路径一起使用

javascript - Node.js 中的解除绑定(bind)事件