Error installing LESS via NPM on Ubuntu

When I try to 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 know how I can fix this? Any details or help would be greatly appreciated.

I tried some of the solutions that are here with the same problem, but to no avail.

Edit: Here is npm-debug.log:

 info it worked if it ends with ok verbose cli [ 'node', '/usr/bin/npm', 'install', '-g', 'less' ] info using npm@1.1.4 info using node@v0.6.12 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 ] 
+5
source share
1 answer

The answer from @therefromhere helped a lot, I'll post it here:

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

It seems that this version of npm no longer supported, updating node (and npm with it) resolved the issue.

Uninstall the obsolete version first (optional, but I think this fixed the problem that I was facing with global modules that were not fixed).

 sudo apt-get purge nodejs npm 

Then install from Chris Lea 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

+10
source

Source: https://habr.com/ru/post/1202105/


All Articles