Grunt安装失败

时间:2013-07-22 15:34:24

标签: npm gruntjs

我正在尝试使用以下命令安装Grunt:

npm install -g grunt-cli

我得到了这个结果:

npm http GET https://registry.npmjs.org/grunt-cli
npm http 304 https://registry.npmjs.org/grunt-cli
npm ERR! Error: No compatible version found: grunt-cli
npm ERR! No valid targets found.
npm ERR! Perhaps not compatible with your version of node?
npm ERR!     at installTargetsError (/usr/share/npm/lib/cache.js:488:10)
npm ERR!     at next_ (/usr/share/npm/lib/cache.js:438:17)
npm ERR!     at next (/usr/share/npm/lib/cache.js:415:44)
npm ERR!     at /usr/share/npm/lib/cache.js:408:5
npm ERR!     at saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7)
npm ERR!     at Object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230:7)
npm ERR! You may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /root/node/npm-debug.log npm
npm ERR! 
npm ERR! System Linux 3.5.0-17-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "grunt-cli"
npm ERR! cwd /root/node
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! message No compatible version found: grunt-cli
npm ERR! message No valid targets found.
npm ERR! message Perhaps not compatible with your version of node?
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /root/node/npm-debug.log
npm not ok

想法?我知道我的Node和npm安装正确。我使用的是Ubuntu Linux 12.04 LTS,标准LAMP安装和npm版本v0.11.5-pre

3 个答案:

答案 0 :(得分:12)

您使用的是旧版本的node.js(v0.6.19)。 Grunt仅与node.js >= 0.8兼容。如果出现重复问题,请参阅此问题:https://github.com/gruntjs/grunt/issues/723

答案 1 :(得分:2)

<强> Ubuntu的

1。使用Ubuntu进行设置

curl -sL https://deb.nodesource.com/setup | sudo bash -

2。然后使用Ubuntu安装

sudo apt-get install -y nodejs

<强>的Debian

1。更新您的存储库

sudo apt-get install curl

  1. 更新您的来源
  2. sudo curl -sL https://deb.nodesource.com/setup | sudo bash -

    来源https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

答案 2 :(得分:1)

通过添加导出NODE_PATH = 输出“哪个节点”到我的.bashrc文件来解决