NPM设置自动配置脚本

时间:2016-12-01 12:32:54

标签: node.js netbeans proxy npm

我在xyz公司工作。他们设置了#34;自动配置脚本"通过Internet Explorer"局域网设置"所有传入和传出

This is how they have set it

现在我想我什么时候

在cmd中

npm install,它不起作用并且会出错。

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v7.2.0
npm ERR! npm  v3.10.9
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! syscall connect

npm ERR! network connect ETIMEDOUT 151.101.40.162: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 settings.
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!     D:\myprojectpath\npm-debug.log
  

现在我想知道是否有任何方法可以设置这个'自动   配置脚本'在npm

2 个答案:

答案 0 :(得分:1)

如果你正在使用Windows(10),你可以去:
    设置 - >网络&互联网 - >代理
它会给你“脚本地址”。这是您的代理自动配置(PAC)文件。

我在这里写了更多关于https://github.com/sblack4/autoconfigure-proxy的文章,并有一个用PAC设置代理的脚本

有关PAC文件的更多信息,请参阅http://www.davidpashley.com/articles/automatic-proxy-configuration-with-wpad/

答案 1 :(得分:0)

如果您无法访问“自动配置脚本”,则需要向组织中的某个人询问访问互联网所需的正确代理设置。

如果您拥有正确的数据,请使用以下命令配置npm:

npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080

如果您遇到问题,请参阅How to setup Node.js and Npm behind a corporate web proxy教程。

有关详细信息,请参阅https://docs.npmjs.com/misc/config