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

Roh*_*hit 5 ubuntu node.js npm bower

我无法安装凉亭.

执行的步骤:

  • 已安装的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
Run Code Online (Sandbox Code Playgroud)

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

Ham*_*oli 12

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

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

sudo apt-get install curl -y
Run Code Online (Sandbox Code Playgroud)

1)清除NPM的缓存:

sudo npm cache clean -f
Run Code Online (Sandbox Code Playgroud)

2)安装一个名为'n'的小助手(节点版本管理器)

sudo npm install -g n
Run Code Online (Sandbox Code Playgroud)

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

sudo n stable
Run Code Online (Sandbox Code Playgroud)

4)再次安装Bower

sudo npm install -g bower
Run Code Online (Sandbox Code Playgroud)


小智 0

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

sudo npm install bower
Run Code Online (Sandbox Code Playgroud)

您必须输入您的 su 密码。