node.js - 无法在 Ubuntu 13.04 上使用 npm 安装 bower

标签 node.js ubuntu npm bower

我无法安装 Bower。

执行的步骤:

  • 已安装 node.js(当前稳定版本 v0.10.12)
  • 使用 apt-get (v1.1.4) 安装了 npm

尝试使用以下方式安装 bower : npm 安装 bower

我收到可能的 node.js 不兼容错误。 奇怪的是,错误日志表明脚本进入了 Node 目录并尝试使用 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

需要一种安装 Bower 的方法。有什么想法吗?

最佳答案

我在 ubuntu 12.04 上遇到了同样的问题,这是我如何解决的:

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

sudo apt-get install curl -y

1) 清除 NPM 的缓存:

sudo npm cache clean -f

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

sudo npm install -g n

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

sudo n stable

4)再次安装Bower

sudo npm install -g bower

关于node.js - 无法在 Ubuntu 13.04 上使用 npm 安装 bower,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17247576/

相关文章:

npm - 获取错误 : Cannot find module './src/init' when trying to initialize a react native app

node.js - react-scripts 将文件构建到 `build` 文件夹中,来自与 `public` 不同的文件夹

angularjs - 我想使用node.js将数据写入mongodb数据库

javascript - 如何使用JS从URL获取查询参数和编码信息

ubuntu - Meta-x 在 Emacs 中不工作

ubuntu - SVN 定义根目录

node.js - 在 TypeScript 中导入 Node 模块

npm - 通过代理 bower

node.js - 如何在 Express.js 中提供用户特定的静态内容

linux - 无法在 Ubuntu 命令行中启动 WebdriverIO