我在安装较少时遇到此错误。我使用此代码npm install -g less
,但它显示了这种错误:
> 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 clean-css@2.0.x npm http 304
> http://registry.npmjs.org/source-map npm ERR! error installing
> less@1.6.3 npm ERR! error rolling back less@1.6.3 Error: UNKNOWN,
> unknown error '/usr/local/lib/node_modules/less'
>
> npm ERR! Unsupported npm ERR! Not compatible with your version of
> node/npm: request@2.44.0 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:/$
编辑:
我根据答案安装了更新版本的节点。我现在有这个提示。这是一个错误吗?感谢
/usr/local/bin/lessc -> /usr/local/lib/node_modules/less/bin/lessc
less@2.5.0 /usr/local/lib/node_modules/less
âââ graceful-fs@3.0.6
âââ mime@1.3.4
âââ image-size@0.3.5
âââ promise@6.1.0 (asap@1.0.0)
âââ errno@0.1.2 (prr@0.0.0)
âââ mkdirp@0.5.0 (minimist@0.0.8)
âââ source-map@0.4.2 (amdefine@0.1.0)
âââ request@2.55.0 (caseless@0.9.0, json-stringify-safe@5.0.0, aws-sign2@0.5.0, forever-agent@0.6.1, stringstream@0.0.4, oauth-sign@0.6.0, tunnel-agent@0.4.0, isstream@0.1.2, node-uuid@1.4.3, qs@2.4.1, combined-stream@0.0.7, form-data@0.2.0, mime-types@2.0.10, tough-cookie@0.13.0, bl@0.9.4, hawk@2.3.1, http-signature@0.10.1, har-validator@1.6.1)
我的Ubuntu版本是12.04。请帮助,我需要尽快为我的项目。谢谢:))
答案 0 :(得分:2)
尝试更新您的节点版本。
npm ERR! Required: ["node >= 0.8.0"]
Actual: {"npm":"1.1.4","node":"0.6.12"}
请点击此处查看说明:https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version
答案 1 :(得分:1)
尝试将您的npm /节点升级到最新版本,然后重试