Travis - Control Which version of Node is used to install NPM

I am trying to install the npm package (markdown-pdf) as part of my Travis-CI build, which I believe is not compatible with older versions of Node. On my local computer, I run Node version 0.10.36 and it works here, so I added that, in my opinion, is an acceptable way to determine a specific version at the top of my file .travis.yml(although I'm not clear on anything) . The full MCVE file version is lower.

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 was installed."

At the top of the build log, I see the following, which seems to indicate that my change worked:

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

, , travis sudo npm install -g markdown-pdf, . , , Node, , Node v0.6.12.

$ sudo npm install -g markdown-pdf
npm http GET 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 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 /home/travis/build/ahemmeter/ahemmeter.imtqy.com/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.imtqy.com
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 with your version of node?
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/travis/build/ahemmeter/ahemmeter.imtqy.com/npm-debug.log
npm not ok

, , github, .

, Node ? ( ) - npm, nvm markdown-pdf? npm-install Node, ?

, HTTP HTTPS. , " : markdown-pdf" " : markdown-pdf", , ; , , .

+4
1

node.js, travis, , package.json. , , node .

.travis.yml

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

package.json

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

OP: , , - , package.json ( , , ), .

+1

All Articles