【问题标题】:Grunt install failureGrunt 安装失败
【发布时间】:2013-07-21 10:18:14
【问题描述】:

我正在尝试使用以下命令安装 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 安装正确。我正在使用带有标准 LAMP 安装和 npm 版本 v0.11.5-pre 的 Ubuntu Linux 12.04 LTS

【问题讨论】:

    标签: npm gruntjs


    【解决方案1】:

    Ubuntu

    1。使用 Ubuntu 设置

    curl -sL @987654321@ | sudo bash -

    2。然后用 Ubuntu 安装

    sudo apt-get install -y nodejs

    Debian

    1。更新您的存储库

    sudo apt-get install curl

    1. 更新您的来源

    sudo curl -sL @987654322@ | sudo bash -

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

    【讨论】:

      【解决方案2】:

      通过将 export NODE_PATH= Output of "which node" 添加到我的 .bashrc 文件中解决

      【讨论】:

      • “哪个节点”的输出是什么?
      【解决方案3】:

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

      【讨论】:

      • 这很奇怪,因为我克隆并安装了 Node.js。应该是最新版本。但问题实际上是 $NODE_PATH 是空的
      • 很高兴你知道了。我建议不要使用 v0.11.5-pre。那是节点的开发版本,并且已知会破坏。偶数节点版本是稳定的。
      • 如果使用 nvm , $NODE_PATH 设置与否,没有影响,安装无论如何都失败了......在我的情况下,问题是使用 sudo 设置 nvm 以使用 -g 开关,但是 nvm节点版本的使用在会话之间不是持久的..这导致了类似的问题,一旦能够将 nvm 设置为使用正确的版本“没有 sudo”.. 一切都很好......
      • @MasonPhillips 刚刚遇到了同样的问题。 “安装”最新版本的node 并没有覆盖我在/usr/bin/node 中现有的旧版本。
      猜你喜欢
      • 1970-01-01
      • 2015-09-20
      • 2019-03-14
      • 2017-09-07
      • 1970-01-01
      • 1970-01-01
      • 2013-02-24
      • 1970-01-01
      相关资源
      最近更新 更多