无法在Heroku中部署NodeJS App [英] Not able to deploy NodeJS App in Heroku

查看:55
本文介绍了无法在Heroku中部署NodeJS App的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用JetBrain Webstrom创建了一个NodeJS应用,现在我想将其部署到heroku.

I created a NodeJS app using JetBrain Webstrom and now i would like to deploy it to heroku.

此图片包含我的应用目录

我应该删除node_modules来部署应用程序吗?还是应该在package.json下添加任何引擎"部分?我应该怎么做才能将我的应用正确部署在heroku中.

Should I remove node_modules to deploy the app ? or should i add any "engine" section under package.json ? What should I do to get my app deployed properly in heroku.

我的应用的package.json:

My app's package.json:

{
  "name": "form",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node ./bin/www"
  },
  "dependencies": {
    "body-parser": "~1.15.2",
    "cookie-parser": "~1.4.3",
    "debug": "~2.2.0",
    "ejs": "~2.5.2",
    "express": "~4.14.0",
    "morgan": "~1.7.0",
    "serve-favicon": "~2.3.0"
  }
}

在推送应用程序时登录:

Log while Pushing the App:

C:\Users\Adhik\formgp>git push heroku master
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 585 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 3 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote:  !     No default language could be detected for this app.
remote:                         HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote:                         See https://devcenter.heroku.com/articles/buildpacks
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to serene-bayou-91098.
remote:
To https://git.heroku.com/serene-bayou-91098.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/serene-bayou-91098.git'

推荐答案

在您的package.json中似乎缺少引擎:

It seems like engines are missing in your package.json:

"engines": {
    "node": "6.7.0",
    "npm": "3.10.3"
  }

另外,部署Procfile可能会有所帮助:

Also deploying a Procfile can be helpful:

web: node ./bin/www

确定要部署整个文件夹吗?检查您的日志:

Are you sure you are deploying the entire folder? Check your logs:

Counting objects: 3, done.

这篇关于无法在Heroku中部署NodeJS App的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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