Heroku上的特定npm版本

时间:2014-11-12 18:39:32

标签: node.js heroku npm

我正在尝试在Heroku上推送我的网络应用,但它需要特定的NPM版本(> 2.0,因为我想从local paths安装模块)。

我尝试在package.json文件中指定我想要的npm版本,如下所示:

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

但它不起作用。我得到以下内容:

[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 git@heroku.com: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 'git@heroku.com:supportkit-test.git'
[13:26:09][Step 3/3] Process exited with code 1

Mailgun是我想从本地路径安装的模块。如您所见,npm版本仍为1.4.28。

如何在Heroku上强制使用特定的NPM版本?

谢谢!

1 个答案:

答案 0 :(得分:1)

如果您需要默认情况下在Heroku上无法使用的特定版本的NPM,则必须build a custom buildpack