无法将node.js应用程序部署到heroku [英] Fail to deploy node.js application to heroku

查看:106
本文介绍了无法将node.js应用程序部署到heroku的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一个简单的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:*
},
引擎:{
node:0.8.8,
npm:1.1.65
}
}

当我 git push heroku master 时,我得到以下跟踪:

  -----> Heroku接收推送
-----> Node.js应用检测到
----->解析引擎版本
使用Node.js版本:0.8.8
使用npm版本:1.1.65
----->获取Node.js二进制文件
----->将节点卖给slug
----->使用npm
安装依赖关系npm ERR!错误:ENOENT,chmod'/ tmp / build_1suuxlhd9s8n6 / node_modules / express / bin / express'
npm ERR!如果您需要帮助,可以通过以下链接报告此日志:
npm ERR! < HTTP://github.com/isaacs/npm/issues>
npm ERR!或通过电子邮件发送至:
npm ERR! < npm-@googlegroups.com>

npm ERR!系统Linux 2.6.32-348-ec2
npm ERR!命令/ tmp / node-node-tonf / bin / node/tmp/node-npm-NG88/cli.jsrebuild
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!代码ENOENT
npm ERR! errno 34
npm ERR!
npm ERR!附加的日志记录细节可以在以下位置找到:
npm ERR! /tmp/build_1suuxlhd9s8n6/npm-debug.log
npm ERR!不好的代码0
!无法用npm
重建依赖关系! Heroku推送被拒绝,未能编译Node.js应用程序

到git@heroku.com:fast-everglades-2007.git
! [remote rejected] master - > master(pre-receive hook refused)
错误:未能将某些参考文献推送到'git@heroku.com:fast-everglades-2007.git'

我试图在我的package.json中调整各种版本,但无济于事。我在windows上开发,可能这个ENOENT问题是由于一些filemode问题。




  • 确保Procfile已被提交到git中

  • >删除node_modules /文件夹并将其提交到git中(git rm -r node_modules /)




之后, git push heroku master然后错误消失。

I am trying to deploy a simple node.js express-based application to heroku, something which is apparently very basic: https://devcenter.heroku.com/articles/nodejs

Here is my 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"
  }
}

When I git push heroku master I got the following trace:

 -----> 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'

I tried to tweak various versions in my package.json but to no avail. I am developing on windows and it might be possible this ENOENT issue is due to some filemode issue.

解决方案

I got this fixed by:

  • Making sure Procfile is committed into git

  • Removing the node_modules/ folder and committing that into git (git rm -r node_modules/)

Afterwards, I did the git push heroku master then the error disappeared.

这篇关于无法将node.js应用程序部署到heroku的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆