我正在使用Visual Studio 2013学习Node.js.我安装了node.js - 来自Visual Studio 2013的Node.js工具1.1.1
https://github.com/Microsoft/nodejstools/releases/tag/v1.1.1
当我发出命令时,以下是命令提示符的结果 - npm install underscore
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\project>npm install underscore
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "underscore"
npm ERR! node v4.6.0
npm ERR! npm v2.15.9
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! network getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
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! Please include the following file with any support request:
npm ERR! C:\project\npm-debug.log
C:\project>
答案 0 :(得分:0)
如果您通过VPN(基于评论)在互联网上,那么您的公司可以使用某种HTTP代理,特别是如果您的浏览器可以工作但命令行工具(例如npm)没有。
通常设置像HTTP_PROXY和https_proxy这样的环境变量效果很好,但我真的不确定在Windows机箱上是否也是如此,因为我在几年前就开始开发它们了。另一种方法是在你的npm config中设置它:
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080