繁体   English   中英

如何在ubuntu中安装bower? 节点已成功安装

[英]How to install bower in ubuntu? node is successfully installed

我是angular.js的新手。 我试图通过输入以下代码行在Ubuntu 12.04中安装bower。 节点已成功安装在本地计算机上。

sudo npm install -g bower

低于错误

npm http GET https://registry.npmjs.org/bower

npm ERR! Error: failed to fetch from registry: bower
npm ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR!     at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR!     at Request.emit (events.js:88:20)
npm ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at HTTPParser.onIncoming (http.js:1261:11)
npm ERR!     at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /home/sameer/npm-debug.log npm
npm ERR! 
npm ERR! System Linux 3.2.0-32-generic
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "bower"
npm ERR! cwd /home/sameer
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: bower
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/sameer/npm-debug.log
npm not ok

npm-debug.log文件包含以下代码

info it worked if it ends with ok
verbose cli [ 'node', '/usr/bin/npm', 'install', '-g', 'bower' ]
info using npm@1.1.4
info using node@v0.6.12
verbose config file /home/sameer/.npmrc
verbose config file /usr/etc/npmrc
verbose config file /usr/share/npm/npmrc
silly exec /usr/bin/node "/usr/share/npm/bin/npm-get-uid-gid.js" "nobody" 1001
silly spawning [ '/usr/bin/node',
silly spawning   [ '/usr/share/npm/bin/npm-get-uid-gid.js', 'nobody', 1001 ],
silly spawning   null ]
silly output from getuid/gid {"uid":65534,"gid":1001}
silly output from getuid/gid 
verbose cache add [ 'bower', null ]
silly cache add: name, spec, args [ undefined, 'bower', [ 'bower', null ] ]
verbose parsed url { pathname: 'bower', path: 'bower', href: 'bower' }
verbose addNamed [ 'bower', '' ]
verbose addNamed [ null, '' ]
silly name, range, hasData [ 'bower', '', false ]
verbose raw, before any munging bower
verbose url resolving [ 'https://registry.npmjs.org/', './bower' ]
verbose url resolved https://registry.npmjs.org/bower
http GET https://registry.npmjs.org/bower
ERR! Error: failed to fetch from registry: bower
ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
ERR!     at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
ERR!     at Request.emit (events.js:88:20)
ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
ERR!     at ClientRequest.emit (events.js:67:17)
ERR!     at HTTPParser.onIncoming (http.js:1261:11)
ERR!     at HTTPParser.onHeadersComplete (http.js:102:31)
ERR! You may report this log at:
ERR!     <http://bugs.debian.org/npm>
ERR! or use
ERR!     reportbug --attach /home/sameer/npm-debug.log npm
ERR! 
ERR! System Linux 3.2.0-32-generic
ERR! command "node" "/usr/bin/npm" "install" "-g" "bower"
ERR! cwd /home/sameer
ERR! node -v v0.6.12
ERR! npm -v 1.1.4
ERR! message failed to fetch from registry: bower
verbose exit [ 1, true ]

看起来你正在运行一个非常旧版本的nodenpm 可能需要更新才能正确安装。 我建议你使用ppa。 请卸载nodejs ,然后运行:

curl -sL https://deb.nodesource.com/setup | sudo bash -

这会将node.js ppa添加到您的存储库,因此它将像任何其他程序一样更新。 现在你只需要安装它,因此:

sudo apt-get install -y nodejs

当完成后,再次运行:

sudo npm install -g bower

除了应该升级的旧版本节点之外,许多(所有?)版本的ubuntu在nodejs名称下安装node可执行文件。 这会通过调用node命令尝试执行节点代码的某些进程产生许多问题。

原因是ubuntu中有另一个包含node二进制的包。 如果您不需要其他包,则可能需要创建符号链接:

$ whereis nodejs
nodejs: /whatever/path/nodejs
$ cd /whatever/path
$ sudo ln -s nodejs node

按照以下命令,您可以使用angularJS轻松安装

  1. sudo apt-get install nodejs
  2. 项目清单
  3. sudo apt-get install -y python-software-properties
  4. sudo add-apt-repository ppa:chris-lea / node.js
  5. sudo apt-get update
  6. npm config set prefix / usr / local

如果要安装bower,请使用以下命令

  1. sudo npm install -g bower
  2. 凉亭安装角#1.3.0-beta.13

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM