Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when installing LESS through NPM on Ubuntu

When I try and install LESS via NPM on my Ubuntu 14.04 system I get this error:

peter@ubuntudevsvr:~$ 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

Does anyone have any clue as to how I can fix this? Any details or help will be greatly appreciated.

I've tried some of the solutions that are on here with a same-ish issue but to no avail.

Edit: Here is the 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 ]
like image 235
Magicp Avatar asked Sep 08 '14 20:09

Magicp


1 Answers

The answer from @therefromhere helped greatly, I shall post it here:

I had this issue with npm v1.1.4 (and node v0.6.12), which are the Ubuntu 12.04 repository versions.

It looks like that version of npm isn't supported any more, updating node (and npm with it) resolved the issue.

First, uninstall the outdated version (optional, but I think this fixed an issue I was having with global modules not being pathed in).

sudo apt-get purge nodejs npm

Then install from Chris Lea's repo:

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

From: here

like image 197
Magicp Avatar answered Oct 06 '22 13:10

Magicp