我正在尝试做什么
我正在尝试将这个简单的应用程序推送到 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/