2014-09-08 37 views
5

Khi tôi cố gắng và cài đặt LESS qua NPM trên hệ thống Ubuntu 14.04 của tôi, tôi nhận được lỗi này:Lỗi khi cài đặt LESS qua NPM trên Ubuntu

[email protected]:~$ sudo npm install -g less 
[sudo] password for peter: 
npm http GET https://registry.npmjs.org/less 
npm ERR! Error: failed to fetch from registry: less 
npm ERR!  at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12 
npm ERR!  at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9) 
npm ERR!  at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18) 
npm ERR!  at Request.callback (/usr/lib/nodejs/request/main.js:119:22) 
npm ERR!  at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58) 
npm ERR!  at Request.emit (events.js:88:20) 
npm ERR!  at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12) 
npm ERR!  at ClientRequest.emit (events.js:67:17) 
npm ERR!  at HTTPParser.onIncoming (http.js:1261:11) 
npm ERR!  at HTTPParser.onHeadersComplete (http.js:102:31) 
npm ERR! You may report this log at: 
npm ERR!  <http://bugs.debian.org/npm> 
npm ERR! or use 
npm ERR!  reportbug --attach /home/peter/npm-debug.log npm 
npm ERR! 
npm ERR! System Linux 3.11.0-20-generic 
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "less" 
npm ERR! cwd /home/peter 
npm ERR! node -v v0.6.12 
npm ERR! npm -v 1.1.4 
npm ERR! message failed to fetch from registry: less 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  /home/peter/npm-debug.log 
npm not ok 

Có ai có bất kỳ đầu mối như thế nào tôi có thể sửa lỗi này? Mọi chi tiết hoặc trợ giúp sẽ được đánh giá cao.

Tôi đã thử một số giải pháp có trên đây với cùng một vấn đề nhưng không có kết quả.

Edit: Đây là NPM-debug.log:

info it worked if it ends with ok 
verbose cli [ 'node', '/usr/bin/npm', 'install', '-g', 'less' ] 
info using [email protected] 
info using [email protected] 
verbose config file /home/peter/.npmrc 
verbose config file /usr/etc/npmrc 
verbose config file /usr/share/npm/npmrc 
silly exec /usr/bin/node "/usr/share/npm/bin/npm-get-uid-gid.js" "nobody" 1000 
silly spawning [ '/usr/bin/node', 
silly spawning [ '/usr/share/npm/bin/npm-get-uid-gid.js', 'nobody', 1000 ], 
silly spawning null ] 
silly output from getuid/gid {"uid":65534,"gid":1000} 
silly output from getuid/gid 
verbose cache add [ 'less', null ] 
silly cache add: name, spec, args [ undefined, 'less', [ 'less', null ] ] 
verbose parsed url { pathname: 'less', path: 'less', href: 'less' } 
verbose addNamed [ 'less', '' ] 
verbose addNamed [ null, '' ] 
silly name, range, hasData [ 'less', '', false ] 
verbose raw, before any munging less 
verbose url resolving [ 'https://registry.npmjs.org/', './less' ] 
verbose url resolved https://registry.npmjs.org/less 
http GET https://registry.npmjs.org/less 
ERR! Error: failed to fetch from registry: less 
ERR!  at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12 
ERR!  at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9) 
ERR!  at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18) 
ERR!  at Request.callback (/usr/lib/nodejs/request/main.js:119:22) 
ERR!  at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58) 
ERR!  at Request.emit (events.js:88:20) 
ERR!  at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12) 
ERR!  at ClientRequest.emit (events.js:67:17) 
ERR!  at HTTPParser.onIncoming (http.js:1261:11) 
ERR!  at HTTPParser.onHeadersComplete (http.js:102:31) 
ERR! You may report this log at: 
ERR!  <http://bugs.debian.org/npm> 
ERR! or use 
ERR!  reportbug --attach /home/peter/npm-debug.log npm 
ERR! 
ERR! System Linux 3.11.0-20-generic 
ERR! command "node" "/usr/bin/npm" "install" "-g" "less" 
ERR! cwd /home/peter 
ERR! node -v v0.6.12 
ERR! npm -v 1.1.4 
ERR! message failed to fetch from registry: less 
verbose exit [ 1, true ] 
+1

Bạn có thể copy-paste file NPM-debug.log của bạn về vấn đề này? – tpae

+0

Xem http://stackoverflow.com/search?q=ubuntu+node+npm –

Trả lời

10

Câu trả lời từ @therefromhere giúp rất nhiều, tôi sẽ đăng nó ở đây:

Tôi có vấn đề này với npm v1.1.4 (và node v0.6.12) , là các phiên bản kho lưu trữ Ubuntu 12.04.

Dường như phiên bản npm không được hỗ trợ nữa, việc cập nhật nút (và npm với nó) đã giải quyết được vấn đề.

Trước tiên, hãy gỡ cài đặt phiên bản lỗi thời (tùy chọn, nhưng tôi nghĩ điều này đã khắc phục được sự cố mà tôi gặp phải với các mô-đun chung không được chuyển vào).

sudo apt-get purge nodejs npm 

Sau đó cài đặt từ repo Chris Lea của:

sudo apt-get update 
sudo apt-get install -y python-software-properties 
sudo add-apt-repository ppa:chris-lea/node.js 
sudo apt-get update 
sudo apt-get install nodejs 

Từ: here

+0

Bạn có thể muốn lưu ý phiên bản npm và nodejs nào bạn đã cài đặt cuối cùng. – kaiser

+0

Bây giờ, nó sẽ cung cấp cho bạn v0.10.37 –

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