[npm install在我看来似乎不起作用
我下载了node.js,当我运行CLI命令npm install -g @angular/cli
时出现以下错误:
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to /@angular%2fcli failed, reason: getaddrinfo ENOTFOUND proxy.example
npm ERR! network This is a problem 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! A complete log of this run can be found in:
npm ERR! C:\Users\Omar Abdelkefi\AppData\Roaming\npm-cache\_logs\2020-03-08T13_10_01_192Z-debug.log
请任何帮助
回答如下:如果有这样的错误...
npm ERR!网络“代理”配置设置正确
那么您必须正确设置代理
$ npm config set proxy http://XXX.XXX.XXX.XXX:XXXX
加号
$ npm config set https-proxy http://XXX.XXX.XXX.XXX:XXXX
您可以通过以下方式检查当前代理:
$ npm config get proxy
如果需要删除代理,请继续执行:(首先尝试以下操作)
$ npm config rm proxy
$ npm config rm https-proxy
[npm install在我看来似乎不起作用
我下载了node.js,当我运行CLI命令npm install -g @angular/cli
时出现以下错误:
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to /@angular%2fcli failed, reason: getaddrinfo ENOTFOUND proxy.example
npm ERR! network This is a problem 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! A complete log of this run can be found in:
npm ERR! C:\Users\Omar Abdelkefi\AppData\Roaming\npm-cache\_logs\2020-03-08T13_10_01_192Z-debug.log
请任何帮助
回答如下:如果有这样的错误...
npm ERR!网络“代理”配置设置正确
那么您必须正确设置代理
$ npm config set proxy http://XXX.XXX.XXX.XXX:XXXX
加号
$ npm config set https-proxy http://XXX.XXX.XXX.XXX:XXXX
您可以通过以下方式检查当前代理:
$ npm config get proxy
如果需要删除代理,请继续执行:(首先尝试以下操作)
$ npm config rm proxy
$ npm config rm https-proxy