如何在Travis CI上安装uglify-js?

时间:2015-05-26 00:25:13

标签: travis-ci uglifyjs

我的构建在Travis CI上失败,因为uglify-js无法安装。输出日志的相关部分如下。我正在安装nodejsnpm,因为这是一个language: cpp构建而不是language: node_js构建(它是一个C ++库,与其他语言绑定,包括一些需要的客户端Javascript缩小)。

$ sudo apt-get install nodejs npm --force-yes --assume-yes --fix-broken
$ sudo npm install -g uglify-js
npm http GET https://registry.npmjs.org/uglify-js
npm ERR! Error: failed to fetch from registry: uglify-js
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/travis/build/stencila/stencila/npm-debug.log npm
npm ERR! 
npm ERR! System Linux 2.6.32-042stab094.7
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "uglify-js"
npm ERR! cwd /home/travis/build/stencila/stencila
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: uglify-js
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/travis/build/stencila/stencila/npm-debug.log
npm not ok
The command "sudo npm install -g uglify-js" failed and exited with 1 during .

1 个答案:

答案 0 :(得分:3)

进一步测试后,您需要运行npm而不sudo来解决您的问题。这样您就不需要事先致电apt-get