2013-08-01 36 views
32

tôi cố gắng để cài đặt module Node.js sử dụng:Lỗi Loại: Yêu cầu đường dẫn chứa ký tự unescaped

npm install express 

nhưng tôi nhận được lỗi này:

npm http GET https://registry.npmjs.org/express 
npm ERR! TypeError: Request path contains unescaped characters. 
npm ERR!  at Agent.request (_http_agent.js:264:11) 
npm ERR!  at TunnelingAgent.exports.request (http.js:52:22) 
npm ERR!  at TunnelingAgent.createSocket (/usr/local/lib/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:117:25) 
npm ERR!  at TunnelingAgent.createSecureSocket [as createSocket] (/usr/local/lib/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:184:41) 
npm ERR!  at TunnelingAgent.addRequest (/usr/local/lib/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:80:8) 
npm ERR!  at new ClientRequest (_http_client.js:112:16) 
npm ERR!  at Agent.request (_http_agent.js:279:10) 
npm ERR!  at Object.exports.request (https.js:130:22) 
npm ERR!  at Request.start (/usr/local/lib/node_modules/npm/node_modules/request/index.js:594:30) 
npm ERR!  at Request.end (/usr/local/lib/node_modules/npm/node_modules/request/index.js:1186:28) 
npm ERR! If you need help, you may report this log at: 
npm ERR!  <http://github.com/isaacs/npm/issues> 
npm ERR! or email it to: 
npm ERR!  <[email protected]> 

npm ERR! System Linux 3.6.11-7.fc16.x86_64 
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "express" 
npm ERR! cwd /usr/local/src/node 
npm ERR! node -v v0.11.5-pre 
npm ERR! npm -v 1.3.5 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  /usr/local/src/node/npm-debug.log 
npm ERR! not ok code 0 

Có thể xảy ra tôi sử dụng một proxy tôi đặt nó theo cách này để cho phép tải xuống từ ips bên ngoài mạng của tôi

export https_proxy='http://172.21.0.12:3128' 

Tôi hy vọng bạn có thể giúp tôi

Trả lời

57

Đặt proxy từ dòng lệnh.

npm config set proxy http://proxydomain:port/ 

Nếu xảy ra lỗi, hãy thử tiếp theo.

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

Làm việc này cho tôi. (ref http://sushichop.blogspot.jp/2013/01/npm-install.html)

+0

cảm ơn bạn rất nhiều! câu trả lời của bạn đã giải quyết được vấn đề của tôi –

+10

Đề xuất thứ hai đã làm điều này, cảm ơn. – Haspemulator

+0

Phải mất cả hai dòng để làm việc cho tôi. Cảm ơn! Bất kỳ ý tưởng tại sao cài đặt máy chủ proxy Ubuntu của tôi không hoạt động cho điều này? – nic

2

Mặc dù đủ trễ, tôi cũng đã gặp phải vấn đề này sau khi cập nhật nodejs (thành 4.1.1) và npm (thành cái gì đó như 1.4.x) trên Linux.

Tôi đã thử giải pháp được đề xuất, nhưng thay đổi mục nhập sổ đăng ký đã không giúp đỡ trong mọi trường hợp. Cuối cùng, sau khi quyết định cài đặt lại NPM, tôi thấy nguồn cập nhật này [trên NPM github] [1]

curl -L https://www.npmjs.org/install.sh | sh 

mà cập nhật NPM tôi để 3.3.8 và tất cả những rắc rối cài đặt gói liên quan đã được thổi bay đi.

Các vấn đề liên quan