2016-04-21 89 views
9

我在deborah kurata的angular2入門課程上使用pluralsight並安裝了node.js,然後運行npm install(安裝cntlm後,因爲我在公司代理防火牆後面):但是我正在接收以下錯誤npm安裝錯誤無法讀取類型

> [email protected] postinstall c:\Users\test\Documents\Visual Studio 2015\Projects\Angular2 
> typings install 

typings ERR! message Unable to read typings for "es6-shim". You should check the entry paths in "es6-shim.d.ts" are up to date 
typings ERR! caused by Unable to connect to  "https://raw.githubusercontent.com/D 
efinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/es6- shim/es6-shim.d.ts" 
typings ERR! caused by connect ECONNREFUSED 103.245.222.133:443 

typings ERR! cwd c:\Users\test\Documents\Visual Studio 2015\Projects\Angular2 

typings ERR! system Windows_NT 6.1.7601 
typings ERR! command "C:\\Program Files\\nodejs\\node.exe"  "c:\\Users\\vivekba\\ 
Documents\\Visual Studio 2015\\Projects\\Angular2\\node_modules\\typings\\dist\\ 
bin.js" "install" 
typings ERR! node -v v5.10.1 
typings ERR! typings -v 0.7.12 

typings ERR! If you need help, you may report this error at: 
typings ERR! <https://github.com/typings/typings/issues> 

npm WARN optional Skipping failed optional dependency /chokidar/fsevents: 
npm WARN notsup Not compatible with your operating system or architecture: fseve 
[email protected] 
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" 
npm ERR! node v5.10.1 
npm ERR! npm v3.8.3 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] postinstall: `typings install` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script 'typings install'. 
npm ERR! Make sure you have the latest version of node.js and npm installed. 
npm ERR! If you do, this is most likely a problem with the product-management package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  typings install 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs product-management 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls product-management 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  c:\Users\test\Documents\Visual Studio 2015\Projects\Angular2\npm 
+0

'由連接ECONNREFUSED'引起的 – drewmoore

回答

5

錯誤是由於連接問題引起的。

您的防火牆絕對是事業的根源。

npm config set proxy "http://company.com:8000" 

或者

npm config set strict-ssl false 

或者

npm config set registry "http://registry.npmjs.org/" 
-

UPDATE

有些人通過設置一個配置解決了這個

您也可以查看issue

第二次更新

如果你使用VS那麼你需要從VS開發者控制檯

  1. Open的VS開發者控制檯
  2. 設置NPM設置配置配置
11

如果您身後代理您可以嘗試此操作(它對我有用)。

創建一個.typingsrc文件,並與您的代理信息添加以下行:

proxy="http://proxyname:port"

Source of my answer

+1

嘗試過,但仍然無效或引發相同的錯誤。我也曾嘗試使用cntlm,但最終出現同樣的錯誤。 – Baahubali

+2

+1這個答案。類型沒有使用NPM代理設置,添加.typingsrc文件與我的.npmrc文件具有相同的設置,使它檢測並正確使用代理 – Joon

3

我解決了佩爾頁的答案的鏈接如下。我創建了一個.typingsrc文件與這些線路:

{ "proxy" : "http://myproxy:port/", "rejectUnauthorized" : false }

+0

這對我工作。謝謝。 –

4

我解決了創建.typingsrc文件在同一文件夾,具有以下內容:

proxy = http://username:[email protected]:port 
https-proxy = http://username:[email protected]:port 

詞語「用戶名」,「密碼「,」ip「和」port「應該替換爲你的代理的值。

+1

這爲我工作。謝謝 –

0

在平行於package.json的項目文件夾中創建.typingscr文件並放在下面一行。請記住,不要以json格式使用ini格式。

rejectUnauthorized = false 

我使用這背後的企業環境沒有任何代理設置,它爲我工作,希望將爲你工作。