node.js - Travis - Control Which Node Version is used for NPM Installs -


i attempting install an npm package (markdown-pdf) part of travis-ci build believe not compatible old versions of node. on local machine, running node version 0.10.36, , works here, added believe accepted way of defining specific version top of .travis.yml file (although i'm not clear on either). mcve version of full file below.

language: node_js node_js: - "0.10" install: - sudo apt-get install npm - npm config set registry http://registry.npmjs.org/ - sudo npm install -g markdown-pdf script: - echo "stuff installed." 

at top of build log, see following, seems indicate change worked:

$ nvm install 0.10 ######################################################################## 100.0% using node v0.10.40 $ node --version v0.10.40 $ npm --version 1.4.28 $ nvm --version 0.23.3 

however, further down log, when travis attempts execute sudo npm install -g markdown-pdf, log reports following. notice suggests package might not compatible version of node installed, , it claims i'm using node v0.6.12.

$ sudo npm install -g markdown-pdf npm http http://registry.npmjs.org/markdown-pdf npm http 200 http://registry.npmjs.org/markdown-pdf npm err! error: no compatible version found: markdown-pdf npm err! no valid targets found. npm err! perhaps not compatible version of node? npm err!     @ installtargetserror (/usr/share/npm/lib/cache.js:488:10) npm err!     @ next_ (/usr/share/npm/lib/cache.js:438:17) npm err!     @ next (/usr/share/npm/lib/cache.js:415:44) npm err!     @ /usr/share/npm/lib/cache.js:408:5 npm err!     @ saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7) npm err!     @ object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230:7) npm err! may report log at: npm err!     <http://bugs.debian.org/npm> npm err! or use npm err!     reportbug --attach /home/travis/build/ahemmeter/ahemmeter.github.io/npm-debug.log npm npm err!  npm err! system linux 2.6.32-042stab108.3 npm err! command "node" "/usr/bin/npm" "install" "-g" "markdown-pdf" npm err! cwd /home/travis/build/ahemmeter/ahemmeter.github.io npm err! node -v v0.6.12 npm err! npm -v 1.1.4 npm err! message no compatible version found: markdown-pdf npm err! message no valid targets found. npm err! message perhaps not compatible version of node? npm err!  npm err! additional logging details can found in: npm err!     /home/travis/build/ahemmeter/ahemmeter.github.io/npm-debug.log npm not ok 

i think i've provided enough information, can @ public build logs project , github repository it's building.

have made mistake in declaring version of node use? need (or should i) similar npm, nvm, , markdown-pdf? how can force npm-install use newer version of node rather old one?

note set repository download on http instead of https. when did that, error message changed "failed fetch registry: markdown-pdf" "no compatible version found: markdown-pdf", seemed step in right direction, kept it; however, mention here in case there possibility causes conflict.

in order specify dependencies when using node.js, travis seems expect package.json file. can use specify version of node package want download.

.travis.yml

language: node_js node_js: - "0.10" script: - echo "stuff installed." 

package.json

{   "name" : "ahemmeter.github.io",   "version" : "0.0.0",   "dependencies" : {     "markdown-pdf" : "5.3.x"   } } 

note op: answer found, if posts answer not involve using package.json file (this test suite rather package , don't want publish package), i'll mark answer accepted.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -