我尝试使用angular-cli创建一个新的Angular2应用程序,但无法使其正常工作。
在npm步骤中 ng new失败:Installing packages for tooling via npm
Installing packages for tooling via npm
typings ERR! message Unable to connect to "https://api.typings.org/entries/dt/es6-shim/tags/0.31.2%2B20160317120654"
typings ERR! caused by getaddrinfo ENOTFOUND company company:443
typings ERR! cwd D:\Source\testsdfsa
typings ERR! system Windows_NT 6.3.9600
typings ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\Source\\testsdfsa\\node_modules\\typings\\dist\\bin.js" "install"
typings ERR! node -v v4.4.7
typings ERR! typings -v 0.8.1
typings ERR! code EUNAVAILABLE
如果我之后尝试运行npm install,我会收到同样的错误。重新启动,从头开始并清除缓存并没有改变任何东西。
如果我尝试在第一次失败后再次安装而不清除缓存,则会出现以下错误:
untar error C:\Users\user\AppData\Local\Temp\npm-2280-3cd29f2f\
registry.npmjs.org\source-map\-\source-map-0.5.6.tgz
untar error C:\Users\user\AppData\Local\Temp\npm-2280-3cd29f2f\
registry.npmjs.org\source-map\-\source-map-0.5.6.tgz
untar error C:\Users\user\AppData\Local\Temp\npm-2280-3cd29f2f\
registry.npmjs.org\bluebird\-\bluebird-3.4.1.tgz
unexpected eof
Error: unexpected eof
at decorate (C:\Users\schnaitlr\AppData\Roaming\npm\node_modules\angular-cli\node_modules\npm\node_modules\fstream\lib\abstract.js:67:36)
at Extract.Abstract.error (C:\Users\schnaitlr\AppData\Roaming\npm\node_modules\angular-cli\node_modules\npm\node_modules\fstream\lib\abstract.js:61:12)
at Extract._streamEnd (C:\Users\schnaitlr\AppData\Roaming\npm\node_modules\angular-cli\node_modules\npm\node_modules\tar\lib\extract.js:91:35)
at BlockStream.<anonymous> (C:\Users\schnaitlr\AppData\Roaming\npm\node_modules\angular-cli\node_modules\npm\node_modules\tar\lib\parse.js:51:8)
at emitNone (events.js:67:13)
at BlockStream.emit (events.js:166:7)
at BlockStream._emitChunk (C:\Users\schnaitlr\AppData\Roaming\npm\node_modules\angular-cli\node_modules\npm\node_modules\tar\node_modules\block-stream\block-stream.js:203:10)
at BlockStream.flush (C:\Users\schnaitlr\AppData\Roaming\npm\node_modules\angular-cli\node_modules\npm\node_modules\tar\node_modules\block-stream\block-stream.js:70:8)
at BlockStream.end (C:\Users\schnaitlr\AppData\Roaming\npm\node_modules\angular-cli\node_modules\npm\node_modules\tar\node_modules\block-stream\block-stream.js:66:8)
at Extract.Parse.end (C:\Users\schnaitlr\AppData\Roaming\npm\node_modules\angular-cli\node_modules\npm\node_modules\tar\lib\parse.js:86:23)
答案 0 :(得分:0)
我发现导致问题的原因是: 我使用
在.typingsrc文件中配置了代理HTTP://DOMAIN\user:pass@url:port
但像npm这样的打字确实会用正向斜线替换反斜杠。这使我们的代理失败了身份验证。对反斜杠进行编码可以解决问题
HTTP://DOMAIN%5Cuser:pass@url:port