将Heroku用于Node Web应用程序 [英] Using Heroku for a Node web application

查看:93
本文介绍了将Heroku用于Node Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Heroku上建立一个项目。我浏览了 Node应用程序教程,我现在试图使用我的存储库来处理我的web应用程序。我已经创建了该项目,它显示在我的Heroku仪表板上,但我无法推送任何内容。这是我每次获得的信息:

  remote:压缩源文件...完成。 
remote:建筑来源:
remote:
remote:----->使用set buildpack heroku / nodejs
remote:
remote:!推送被拒绝,未能检测到设置buildpack heroku / nodejs
remote:更多信息:https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote:验证部署...
remote:
remote:!拒绝推送到your_web_app。

我确定buildpack设置为nodejs。我使用Heroku的信息以及 Heroku错误地检测到我的节点应用程序作为一个Ruby应用程序,但我仍然无法部署。



我也已经进入package.json文件并添加到我的节点版本的引擎部分。为什么我不能部署到Heroku?



编辑:这是我的package.json文件:

 {
name:node,
version:0.0.0,
private:true,
脚本:{
start:node ./bin/www
},
dependencies:{
body-parser:〜1.13。 2,
cookie-parser:〜1.3.5,
debug:〜2.2.0,
express:〜4.13.1,
jade:〜1.11.0,
morgan:〜1.6.1,
serve-favicon:〜2.3.0
},
engines:{
node:5.7.0
}
}

1-应用程序有一个<$ c

解决方案

2- app具有在包中定义的节点版本。 json as:

 engines:{
node:4.1。 1

编辑: buildpacks修复



heroku buildpacks:清除 //清除buildpack



heroku buildpacks:set heroku / nodejs //为node.js应用设置正确的构建包





heroku buildpacks:set https://github.com/heroku/heroku-buildpack-nodejs -a your-app-name


I am trying to set up a project on Heroku. I went through their tutorial for Node apps and I am now trying to use my repository to work on my web app. I have already created the project and it shows up on my Heroku dashboard but I can't push anything to it. This is the message I get every time:

remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Using set buildpack heroku/nodejs
remote: 
remote:  !     Push rejected, failed to detect set buildpack heroku/nodejs
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote: 
remote: Verifying deploy...
remote: 
remote: !   Push rejected to your_web_app.

I've made sure the buildpack is set to nodejs. I used information from Heroku along with Heroku wrongly detecting my Node app as a Ruby app, but still I cannot deploy.

I also already went into the package.json file and added in my node version under the "engine" section. Why can't I deploy to Heroku still?

EDIT: Here is my package.json file:

{
  "name": "node",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node ./bin/www"
  },
  "dependencies": {
    "body-parser": "~1.13.2",
    "cookie-parser": "~1.3.5",
    "debug": "~2.2.0",
    "express": "~4.13.1",
    "jade": "~1.11.0",
    "morgan": "~1.6.1",
    "serve-favicon": "~2.3.0"
  },
  "engines": {
    "node": "5.7.0"
  }
}

解决方案

Ensure following things:

1- app has a package.json file in the root directory.

2- app has node version defined in package.json as:

"engines": {
    "node": "4.1.1"
  },

Edit: buildpacks fix,

heroku buildpacks:clear //clear buildpack

heroku buildpacks:set heroku/nodejs //set correct build pack for node.js app

OR

heroku buildpacks:set https://github.com/heroku/heroku-buildpack-nodejs -a your-app-name

这篇关于将Heroku用于Node Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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