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

时间:2021-02-08 06:55:13

I am not able to install bower.

我不能安装凉亭。

Steps carried out :

步骤进行:

  • Installed node.js (current stable version v0.10.12)
  • 安装节点。js(当前稳定版本v0.10.12)
  • Installed npm using apt-get (v1.1.4)
  • 使用apt-get安装npm (v1.1.4)

Tried installing bower using : npm install bower

尝试安装bower: npm安装bower。

I get the possible node.js incompatible error. The weird thing is that the error log indicates that the script went to the node directory & tried node -v to get an old version of node.js (v0.6.19) though when I do so manually I get v.0.10.12.

我得到了可能的节点。js不兼容的错误。奇怪的是,错误日志指示脚本进入节点目录并尝试使用node -v来获得旧版本的节点。但当我手动操作时,我得到了v0.10.12。

Error Log :

错误日志:

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

Need a way to install bower. Any ideas ?

需要一种安装bower的方法。什么好主意吗?

4 个解决方案

#1


12  

I had the same issue on ubuntu 12.04 here is how I fixed it:

我在ubuntu 12.04上也有同样的问题,我是这样解决的:

As GabLeRoux mentioned, Node version manager requires curl package to be installed and therefore you might need to install curl before:

正如GabLeRoux提到的,Node version manager需要安装curl包,因此您可能需要在之前安装curl:

sudo apt-get install curl -y

1) Clear NPM's cache:

1)明确NPM的缓存:

sudo npm cache clean -f

2) Install a little helper called 'n' (node version manager)

2)安装一个小助手,称为“n”(节点版本管理器)

sudo npm install -g n

3) Install latest stable NodeJS version

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

sudo n stable

4) Install Bower again

4)安装鲍尔

sudo npm install -g bower

#2


0  

Try this, because you must install it as superuser:

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

sudo npm install bower

You must type in your su password.

您必须输入您的su密码。

#3


0  

I recommend using the linux binary from nodejs.org. Available for both 32-bit and 64-bit versions and installs with NPM:

我推荐使用nodejs.org的linux二进制文件。可用于32位和64位版本,并安装NPM:

http://nodejs.org/download/

http://nodejs.org/download/

This should prevent any node/npm version conflicts.

这将防止任何节点/npm版本冲突。

#4


0  

For Cent OS users -

对于Cent OS用户来说——

I first had to update NPM to get around this, and was getting errno 34 for bower on CentOS 7

我首先需要更新NPM来解决这个问题,并且在CentOS 7上得到了第34号的bower。

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

If you get sudo npm command not found, you can edit /etc/sudoers to include npm bin path

如果您没有找到sudo npm命令,您可以编辑/etc/sudoers以包含npm bin路径。

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

#1


12  

I had the same issue on ubuntu 12.04 here is how I fixed it:

我在ubuntu 12.04上也有同样的问题,我是这样解决的:

As GabLeRoux mentioned, Node version manager requires curl package to be installed and therefore you might need to install curl before:

正如GabLeRoux提到的,Node version manager需要安装curl包,因此您可能需要在之前安装curl:

sudo apt-get install curl -y

1) Clear NPM's cache:

1)明确NPM的缓存:

sudo npm cache clean -f

2) Install a little helper called 'n' (node version manager)

2)安装一个小助手,称为“n”(节点版本管理器)

sudo npm install -g n

3) Install latest stable NodeJS version

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

sudo n stable

4) Install Bower again

4)安装鲍尔

sudo npm install -g bower

#2


0  

Try this, because you must install it as superuser:

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

sudo npm install bower

You must type in your su password.

您必须输入您的su密码。

#3


0  

I recommend using the linux binary from nodejs.org. Available for both 32-bit and 64-bit versions and installs with NPM:

我推荐使用nodejs.org的linux二进制文件。可用于32位和64位版本,并安装NPM:

http://nodejs.org/download/

http://nodejs.org/download/

This should prevent any node/npm version conflicts.

这将防止任何节点/npm版本冲突。

#4


0  

For Cent OS users -

对于Cent OS用户来说——

I first had to update NPM to get around this, and was getting errno 34 for bower on CentOS 7

我首先需要更新NPM来解决这个问题,并且在CentOS 7上得到了第34号的bower。

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

If you get sudo npm command not found, you can edit /etc/sudoers to include npm bin path

如果您没有找到sudo npm命令,您可以编辑/etc/sudoers以包含npm bin路径。

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