node.js - 赫罗库 | Node.js : No cedar-supported app detected

标签 node.js heroku

我正在尝试做什么

我正在尝试将这个简单的应用程序推送到 Heroku:

var express = require("express");
var app = express();

app.set('port', (process.env.PORT || 5000));

app.get ("/", function(req, res) {
        res.send('Hello World')
});

app.listen(app.get('port'));

来自包含这些文件的 git 根目录:

drwxr-xr-x@  9 test  staff   306 27 Okt 20:41 .
drwx------@ 16 test  staff   544 27 Okt 20:28 ..
-rw-r--r--@  1 test  staff  6148 22 Okt 08:57 .DS_Store
drwxr-xr-x@ 11 test  staff   374 27 Okt 20:28 .git
-rw-r--r--@  1 test  staff    18 27 Okt 16:05 Procfile
-rw-r--r--@  1 test  staff   196 27 Okt 15:46 index.js
drwxr-xr-x@  3 test  staff   102 27 Okt 20:28 node_modules
-rw-r--r--@  1 test  staff   323 27 Okt 20:41 package.json
-rw-r--r--@  1 test  staff   323 27 Okt 20:31 package.json~

package.json 包含以下内容:

{
  "name": "podio_script",
  "version": "1.0.0",
  "description": "test",
  "main": "index.js",
  "scripts": {
    "start": "node index.js"
  },
  "dependencies": {
   "express": "4.13.3"
  },
  "engines": {
   "node": "0.12.7"
  },
  "author": "James Dean",
  "license": "MIT"
}

Procfile 包含以下内容:

web: node index.js

我的问题是什么

当我运行 git push heroku master 时,我收到此错误消息:

! Push rejected, no Cedar-supported app detected remote: HINT: This occurs when Heroku cannot detect the buildpack remote: to use for this application automatically. remote: See https://devcenter.heroku.com/articles/buildpacks

我找到的资源告诉我此消息是由缺少 package.json 文件引起的。但就我而言,该文件就在那里。

我做错了什么? TIA

最佳答案

在推送到 Heroku 之前必须执行以下 git 步骤:

git init // create repository
git add [files] // add all relevant files to the repository
git commit // commit the new files

关于node.js - 赫罗库 | Node.js : No cedar-supported app detected,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33377274/

相关文章:

node.js - GeddyJs(NodeJs 框架)部署到 heroku cedar 堆栈崩溃

Node.js readUIntBE 任意大小限制?

javascript - 将参数数组从node.js传递给CasperJS

ruby-on-rails - 多个 worker 的 Rails DB Performance

ruby-on-rails - 我正在尝试将我的 ruby​​ on rails 应用程序部署到 heroku 并且它部署正确

python - Heroku:部署深度学习模型

ruby-on-rails - rake 数据库 :create fails to connect to server: No such file or directory

angularjs - 如何托管 Angularjs 应用程序或 M.E.A.N. Apache 或 NodeJS 服务器上的客户端应用程序?

javascript - 如何使用 Express 和 Node.js 从表单发送参数

javascript - 未安装 Sails