Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specific npm version on Heroku

I'm trying to push my web app on Heroku however it requires a specific NPM version (>2.0 namely because I want to install modules from local paths).

I tried specifying the npm version I want in my package.json file like this:

    "engines": {
    "node": "0.10.x",
    "npm": "2.1.6"
    },

But it does not work. I get the following:

[13:26:09][Step 3/3] 80 http 200 https://registry.npmjs.org/mailgun
[13:26:09][Step 3/3] 81 silly registry.get cb [ 200,
[13:26:09][Step 3/3] 81 silly registry.get   { date: 'Wed, 12 Nov 2014 18:26:08 GMT',
[13:26:09][Step 3/3] 81 silly registry.get     server: 'CouchDB/1.5.0 (Erlang OTP/R16B03)',
[13:26:09][Step 3/3] 81 silly registry.get     etag: '"4TEYXG8V5ESBTLTLYGNM1K3VM"',
[13:26:09][Step 3/3] 81 silly registry.get     'content-type': 'application/json',
[13:26:09][Step 3/3] 81 silly registry.get     'cache-control': 'max-age=60',
[13:26:09][Step 3/3] 81 silly registry.get     'content-length': '14782',
[13:26:09][Step 3/3] 81 silly registry.get     'accept-ranges': 'bytes',
[13:26:09][Step 3/3] 81 silly registry.get     via: '1.1 varnish',
[13:26:09][Step 3/3] 81 silly registry.get     age: '44',
[13:26:09][Step 3/3] 81 silly registry.get     'x-served-by': 'cache-jfk1024-JFK',
[13:26:09][Step 3/3] 81 silly registry.get     'x-cache': 'HIT',
[13:26:09][Step 3/3] 81 silly registry.get     'x-cache-hits': '1',
[13:26:09][Step 3/3] 81 silly registry.get     'x-timer': 'S1415816768.787241,VS0,VE0',
[13:26:09][Step 3/3] 81 silly registry.get     vary: 'Accept',
[13:26:09][Step 3/3] 81 silly registry.get     'keep-alive': 'timeout=10, max=50',
[13:26:09][Step 3/3] 81 silly registry.get     connection: 'Keep-Alive' } ]
[13:26:09][Step 3/3] 82 silly lockFile 17d20b4b-mailgun-file-vendor-node-mailgun mailgun@file:./vendor/node-mailgun
[13:26:09][Step 3/3] 83 silly lockFile 17d20b4b-mailgun-file-vendor-node-mailgun mailgun@file:./vendor/node-mailgun
[13:26:09][Step 3/3] 84 error notarget No compatible version found: mailgun@'file:./vendor/node-mailgun'
[13:26:09][Step 3/3] 84 error notarget Valid install targets:
[13:26:09][Step 3/3] 84 error notarget ["0.1.6","0.4.0","0.4.1","0.4.2","0.4.3","0.5.0"]
[13:26:09][Step 3/3] 84 error notarget
[13:26:09][Step 3/3] 84 error notarget This is most likely not a problem with npm itself.
[13:26:09][Step 3/3] 84 error notarget In most cases you or one of your dependencies are requesting
[13:26:09][Step 3/3] 84 error notarget a package version that doesn't exist.
[13:26:09][Step 3/3] 85 error System Linux 3.8.11-ec2
[13:26:09][Step 3/3] 86 error command "/tmp/build_1e56200e13db384069333f3304918966/vendor/node/bin/node" "/tmp/build_1e56200e13db384069333f3304918966/vendor/node/bin/npm" "install" "--userconfig" "/tmp/build_1e56200e13db384069333f3304918966/.npmrc" "--production"
[13:26:09][Step 3/3] 87 error cwd /tmp/build_1e56200e13db384069333f3304918966
[13:26:09][Step 3/3] 88 error node -v v0.10.33
[13:26:09][Step 3/3] 89 error npm -v 1.4.28
[13:26:09][Step 3/3] 90 error code ETARGET
[13:26:09][Step 3/3] 91 verbose exit [ 1, true ]
[13:26:09][Step 3/3] 
[13:26:09][Step 3/3]  !     Push rejected, failed to compile Multipack app
[13:26:09][Step 3/3] 
[13:26:09][Step 3/3] To [email protected]:supportkit-test.git
[13:26:09][Step 3/3]  ! [remote rejected] deploy -> master (pre-receive hook declined)
[13:26:09][Step 3/3] error: failed to push some refs to '[email protected]:supportkit-test.git'
[13:26:09][Step 3/3] Process exited with code 1

Mailgun is a module I want to install from a local path. As you can see, the npm version is still 1.4.28.

Any idea on how to force a specific NPM version on Heroku?

Thanks!

like image 450
Dominic Jodoin Avatar asked Nov 10 '22 23:11

Dominic Jodoin


1 Answers

If you need a specific version of NPM that is not available by default on Heroku then you'll have to build a custom buildpack.

like image 196
Daniel Avatar answered Nov 14 '22 23:11

Daniel