Search code examples
lessnpmvagrantvirtual-machineubuntu-server

Cannot install less using npm in Ubuntu within VM


I am having this error in installing less. I use this code npm install -g less but it's showing this kind of error:

> vagrant@precise32:/$ sudo npm install -g less 
> npm http GET http://registry.npmjs.org/less npm http 304
> http://registry.npmjs.org/less npm http GET
> http://registry.npmjs.org/mime npm http GET
> http://registry.npmjs.org/mkdirp npm http GET
> http://registry.npmjs.org/request npm http GET
> http://registry.npmjs.org/clean-css npm http GET
> http://registry.npmjs.org/source-map npm http 304
> http://registry.npmjs.org/mime npm http 304
> http://registry.npmjs.org/request npm http 304
> http://registry.npmjs.org/mkdirp npm http 304
> http://registry.npmjs.org/clean-css npm WARN optional dependency
> failed, continuing [email protected] npm http 304
> http://registry.npmjs.org/source-map npm ERR! error installing
> [email protected] npm ERR! error rolling back [email protected] Error: UNKNOWN,
> unknown error '/usr/local/lib/node_modules/less'
> 
> npm ERR! Unsupported npm ERR! Not compatible with your version of
> node/npm: [email protected] npm ERR! Required: ["node >= 0.8.0"] npm ERR!
> Actual:   {"npm":"1.1.4","node":"0.6.12"} npm ERR! npm ERR! System
> Linux 3.2.0-23-generic-pae npm ERR! command "node" "/usr/bin/npm"
> "install" "-g" "less" npm ERR! cwd / npm ERR! node -v v0.6.12 npm ERR!
> npm -v 1.1.4 npm ERR! code ENOTSUP npm ERR! message Unsupported npm
> ERR! errno {} npm http GET http://registry.npmjs.org/requirejs/0.26.0
> npm ERR! npm ERR! Additional logging details can be found in: npm ERR!
> /npm-debug.log npm not ok vagrant@precise32:/$

EDITED:

I installed newer version of node based on the answers. Im having now this prompt. Is this an error? thanks

/usr/local/bin/lessc -> /usr/local/lib/node_modules/less/bin/lessc
[email protected] /usr/local/lib/node_modules/less
âââ [email protected]
âââ [email protected]
âââ [email protected]
âââ [email protected] ([email protected])
âââ [email protected] ([email protected])
âââ [email protected] ([email protected])
âââ [email protected] ([email protected])
âââ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

my version of Ubuntu is 12.04. Please help, I need it as soon as possible for my project. Thanks :)


Solution

  • Try updating your version of node.

    npm ERR! Required: ["node >= 0.8.0"]
    Actual: {"npm":"1.1.4","node":"0.6.12"}
    

    See here for instructions: https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version