Heroku npm版本与Strongloop buildpack

时间:2015-02-13 15:03:02

标签: node.js heroku npm strongloop

所以我有一个建立在loopback.io之上的项目。我在package.json中指定了node和npm版本。但是,由于安装时出于某些奇怪的原因,服务器似乎仍然使用npm = 1.4.28。关于我还需要做什么的想法?现在我假设因为npm = 1.4.28,它导致lodash安装问题。

我通常在heroku上构建Strongloop:heroku apps:create --buildpack https://github.com/strongloop/strongloop-buildpacks.git

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

来自heroku的日志在git push

remote:        
remote:        npm ERR! EEXIST, open '/app/.npm/ea4720da-app-npm-lodash-2-4-1-package-tgz.lock'
remote:        File exists: /app/.npm/ea4720da-app-npm-lodash-2-4-1-package-tgz.lock
remote:        Move it away, and try again. 
remote:        
remote:        npm ERR! System Linux 3.13.0-40-generic
remote:        npm ERR! command "/tmp/build_bf55002725acbaa28a6caabb58f75a77/vendor/node/bin/node" "/tmp/build_bf55002725acbaa28a6caabb58f75a77/vendor/node/bin/npm" "install" "--production"
remote:        npm ERR! cwd /tmp/build_bf55002725acbaa28a6caabb58f75a77
remote:        npm ERR! node -v v0.10.35
remote:        npm ERR! npm -v 1.4.28
remote:        npm ERR! path /app/.npm/ea4720da-app-npm-lodash-2-4-1-package-tgz.lock
remote:        npm ERR! code EEXIST
remote:        npm ERR! errno 47
remote:        npm ERR! not ok code 0
remote: 
remote:  !     Push rejected, failed to compile Node.js app
remote: 
remote: Verifying deploy...

1 个答案:

答案 0 :(得分:1)

我能够通过暂时禁用Heroku使用缓存来解决这个问题:

heroku config:set NODE_MODULES_CACHE=false

推送构建,然后重新打开缓存。