我正在尝试将一个简单的基于node.js express的应用程序部署到heroku,这显然是非常基础的东西:https://devcenter.heroku.com/articles/nodejs
这是我的package.json:
{
"name": "cours-lic3-blois",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node app"
},
"dependencies": {
"express": "*",
"ejs": "*",
"github-flavored-markdown": "*",
"less-middleware": "*"
},
"engines": {
"node": "0.8.8",
"npm": "1.1.65"
}
}当我执行git push heroku master命令时,我得到了以下跟踪:
-----> Heroku receiving push
-----> Node.js app detected
-----> Resolving engine versions
Using Node.js version: 0.8.8
Using npm version: 1.1.65
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
npm ERR! Error: ENOENT, chmod '/tmp/build_1suuxlhd9s8n6/node_modules/express/bin/express'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Linux 2.6.32-348-ec2
npm ERR! command "/tmp/node-node-tonf/bin/node" "/tmp/node-npm-NG88/cli.js" "rebuild"
npm ERR! cwd /tmp/build_1suuxlhd9s8n6
npm ERR! node -v v0.8.8
npm ERR! npm -v 1.1.65
npm ERR! path /tmp/build_1suuxlhd9s8n6/node_modules/express/bin/express
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /tmp/build_1suuxlhd9s8n6/npm-debug.log
npm ERR! not ok code 0
! Failed to rebuild dependencies with npm
! Heroku push rejected, failed to compile Node.js app
To git@heroku.com:fast-everglades-2007.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:fast-everglades-2007.git'我尝试在我的package.json中调整不同的版本,但都无济于事。我正在windows上开发,可能这个环境问题是由于一些文件模式问题造成的。
发布于 2013-02-14 17:07:31
我通过以下方式解决了这个问题:
模块确保Procfile已提交到git 模块中删除_
之后,我做了git推送heroku master,然后错误就消失了。
发布于 2013-02-23 08:34:51
我有这个问题,是因为:
node_modules in version controlbin in my .gitignore npm正在尝试chmod express/bin/express,但是由于我的.gitignore,这个文件不在git中,因此在部署期间没有被克隆,所以失败了。我没有注意到它,因为本地npm安装将照常创建bin/express文件。
从.gitignore中删除bin并提交丢失的文件为我解决了这个问题。
发布于 2013-03-22 06:31:38
Heroku团队,您是否可以考虑将npm配置为默认使用npm install --no-bin-links --production,或者创建一个环境变量让用户设置该标志。这是节点安装中的一个严重错误。从我的.gitignore中删除bin目录(如下所示)使我能够进行部署,但它在跨平台开发环境中使用git时会中断,需要在每次node_modules可能发生更改的git拉出时进行显式npm重建。
NPM的最佳实践是避免在.gitignore中使用node_modules (参见http://www.futurealoof.com/posts/nodemodules-in-git.html )。
我相信--no-bin-links将提供两全其美的功能,支持在已排除bin目录的情况下部署node_modules,支持npm重建,但在创建bin链接时不会失败。
我在这里提交了拉取请求:https://github.com/heroku/heroku-buildpack-nodejs/pull/33
谢谢!
https://stackoverflow.com/questions/13321231
复制相似问题