npm 无法安装 angular-cli
npm Unable to Install angular-cli
我正在尝试通过 npm 安装 angular-cli。我安装了最新版本的 Nodejs 和 git。我不支持任何代理服务器(通过 netsh winhttp show proxy
以及 Internet Explorer LAN 设置验证)并且我的互联网连接没有问题。当我尝试 运行
npm install -g angular-cli
然后我得到以下错误
C:\Windows\system32>npm install -g angular-cli
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" "-g" "angular-cli"
npm ERR! node v7.3.0
npm ERR! npm v3.10.10
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! syscall connect
npm ERR! network connect ETIMEDOUT 151.101.192.162:80
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:\Windows\system32\npm-debug.log
我尝试通过 npm cache clean
清理缓存,还尝试通过
将注册表更改为 http:\
npm config set registry http://registry.npmjs.org/
我也试过卸载nodejs并重新安装,但还是不行。我遇到了同样的错误。任何想法。
是的,这可能是由防火墙或代理引起的。你能 ping npm 注册表主机并获取一个简单的文件吗?
> ping registry.npmjs.org
> npm view npm version
如果 ping 不成功,请检查您的连接或禁用您的防火墙。
这种问题通常发生在您位于代理或防火墙之后,阻止 npm 获取请求的包。
如果您知道您的代理地址和端口,请打开控制台并在 运行 npm 之前设置您的 HTTP_PROXY 和 HTTPS_PROXY 变量,如下所示:
set HTTP_PROXY = "http://<proxy server name or IP address>:<proxy port>"
set HTTPS_PROXY = ... ;same as above
npm install <package_name>
未来的观众:试试下面的方法(对我有用)
转到 nodejs 安装位置(路径可能与您的情况不同)
C:\程序Files\nodejs\node_modules\npm
在 npmrc 文件中添加以下条目然后保存
strict-ssl=false
然后尝试安装 angular cli
npm install -g @angular/cli
我遇到了类似的问题,认为我们需要将代理和安装命令结合在一起,如下所示,它对我有用。希望它对你们有用。谢谢!!
npm --proxy http://username:password@proxyURL:port install -g @angular/cli --without-ssl --insecure
步骤 1:打开 windows 命令提示符,然后键入以下命令以获取代理服务器的 IP 地址
ping your-proxy-name
例如:
ping myproxy.xyz.com
第 2 步:打开 Node.js 命令提示符并键入以下命令
npm config set http-proxy http://your-proxy-ip-retrieved-in-step-1:port
npm config set https-proxy http://your-proxy-ip-retrieved-in-step-1:port
例如:
npm config set http-proxy http://192.168.192.95:8080
npm config set https-proxy http://192.168.192.95:8080
Setp-3:在 Node.js 命令提示符下键入以下命令进行安装 angular
npm install -g @angular/cli
希望对你有用。
您需要覆盖代理设置才能安装 angular CLI。
尝试执行以下命令:
npm config set registry http://registry.npmjs.org/
这将覆盖您的代理,您无需对连接或防火墙进行任何更改。成功执行此命令后,尝试使用以下命令安装 angular CLI:
npm install -g @angular/cli
请参阅 this link 了解更多详情。
这为我解决了问题。希望这对您有所帮助!
我正在尝试通过 npm 安装 angular-cli。我安装了最新版本的 Nodejs 和 git。我不支持任何代理服务器(通过 netsh winhttp show proxy
以及 Internet Explorer LAN 设置验证)并且我的互联网连接没有问题。当我尝试 运行
npm install -g angular-cli
然后我得到以下错误
C:\Windows\system32>npm install -g angular-cli
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" "-g" "angular-cli"
npm ERR! node v7.3.0
npm ERR! npm v3.10.10
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! syscall connect
npm ERR! network connect ETIMEDOUT 151.101.192.162:80
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:\Windows\system32\npm-debug.log
我尝试通过 npm cache clean
清理缓存,还尝试通过
npm config set registry http://registry.npmjs.org/
我也试过卸载nodejs并重新安装,但还是不行。我遇到了同样的错误。任何想法。
是的,这可能是由防火墙或代理引起的。你能 ping npm 注册表主机并获取一个简单的文件吗?
> ping registry.npmjs.org
> npm view npm version
如果 ping 不成功,请检查您的连接或禁用您的防火墙。
这种问题通常发生在您位于代理或防火墙之后,阻止 npm 获取请求的包。
如果您知道您的代理地址和端口,请打开控制台并在 运行 npm 之前设置您的 HTTP_PROXY 和 HTTPS_PROXY 变量,如下所示:
set HTTP_PROXY = "http://<proxy server name or IP address>:<proxy port>"
set HTTPS_PROXY = ... ;same as above
npm install <package_name>
未来的观众:试试下面的方法(对我有用)
转到 nodejs 安装位置(路径可能与您的情况不同)
C:\程序Files\nodejs\node_modules\npm
在 npmrc 文件中添加以下条目然后保存
strict-ssl=false
然后尝试安装 angular cli
npm install -g @angular/cli
我遇到了类似的问题,认为我们需要将代理和安装命令结合在一起,如下所示,它对我有用。希望它对你们有用。谢谢!!
npm --proxy http://username:password@proxyURL:port install -g @angular/cli --without-ssl --insecure
步骤 1:打开 windows 命令提示符,然后键入以下命令以获取代理服务器的 IP 地址
ping your-proxy-name
例如:
ping myproxy.xyz.com
第 2 步:打开 Node.js 命令提示符并键入以下命令
npm config set http-proxy http://your-proxy-ip-retrieved-in-step-1:port
npm config set https-proxy http://your-proxy-ip-retrieved-in-step-1:port
例如:
npm config set http-proxy http://192.168.192.95:8080
npm config set https-proxy http://192.168.192.95:8080
Setp-3:在 Node.js 命令提示符下键入以下命令进行安装 angular
npm install -g @angular/cli
希望对你有用。
您需要覆盖代理设置才能安装 angular CLI。 尝试执行以下命令:
npm config set registry http://registry.npmjs.org/
这将覆盖您的代理,您无需对连接或防火墙进行任何更改。成功执行此命令后,尝试使用以下命令安装 angular CLI:
npm install -g @angular/cli
请参阅 this link 了解更多详情。
这为我解决了问题。希望这对您有所帮助!