首页 文章

无法在Ubuntu 13.04上使用npm安装bower

提问于
浏览
5

我无法安装凉亭 .

执行的步骤:

  • 已安装node.js(当前稳定版本v0.10.12)

  • 使用apt-get(v1.1.4)安装npm

尝试安装凉亭使用:npm安装凉亭

我得到可能的node.js不兼容的错误 . 奇怪的是,错误日志表明脚本进入节点目录并尝试使用node -v获取旧版本的node.js(v0.6.19),但是当我手动执行v.0.10.12时 .

错误日志:

npm http GET https://registry.npmjs.org/bower
npm ERR! Error: No compatible version found: bower
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 /usr/share/node-v0.10.12/npm-debug.log npm
npm ERR! 
npm ERR! System Linux 3.8.0-25-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "bower"
npm ERR! cwd /usr/share/node-v0.10.12
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! message No compatible version found: bower
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!     /usr/share/node-v0.10.12/npm-debug.log
npm not ok

需要一种安装凉亭的方法 . 有任何想法吗 ?

4 回答

  • 0

    我在ubuntu 12.04上遇到了同样的问题,这是我修复它的方法:

    正如GabLeRoux所提到的,Node版本管理器需要安装curl包,因此您可能需要先安装curl:

    sudo apt-get install curl -y
    

    1)清除NPM的缓存:

    sudo npm cache clean -f
    

    2)安装一个名为'n'的小助手(node version manager

    sudo npm install -g n
    

    3)安装最新的稳定NodeJS版本

    sudo n stable
    

    4)再次安装Bower

    sudo npm install -g bower
    
  • 0

    试试这个,因为你必须以超级用户身份安装它:

    sudo npm install bower
    

    您必须输入您的su密码 .

  • 0

    我建议使用nodejs.org中的linux二进制文件 . 适用于32位和64位版本,并可与NPM一起安装:

    http://nodejs.org/download/

    这应该可以防止任何node / npm版本冲突 .

  • 12

    对于Cent OS用户 -

    我首先必须更新NPM才能解决这个问题,并且在CentOS 7上获得了34号bower的errno 34

    sudo npm install -g npm
    sudo npm install -g bower
    

    如果你得到 sudo npm command not found ,你可以编辑 /etc/sudoers 以包含npm bin路径

    Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
    

相关问题