我正在尝试将一个简单的node.js基于表达的应用程序部署到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"
}
}
Run Code Online (Sandbox Code Playgroud)
当我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'
Run Code Online (Sandbox Code Playgroud)
我尝试在我的package.json中调整各种版本,但无济于事.我正在开发Windows,这可能是因为某些文件模式问题导致ENOENT问题.
Arb*_*ong 16
我得到了这个修复:
确保Procfile被提交到git中
删除node_modules /文件夹并将其提交到git(git rm -r node_modules /)
之后,我做了git push heroku master然后错误就消失了.
我遇到了这个问题,原因是:
node_modules版本控制bin我的.gitignore文件npm试图chmod express/bin/express,但由于我的.gitignore这个文件不是在git中,因此在部署期间没有被克隆,所以它失败了.我没注意到它,因为本地npm安装会bin/express像往常一样创建文件.
删除bin从.gitignore和提交丢失的文件解决了这个问题对我来说.
| 归档时间: |
|
| 查看次数: |
14560 次 |
| 最近记录: |