Heroku网站抛出错误:[Checkbox]Element 1
[Checkbox]Element 1.1
[Checkbox]Element 1.2
[Checkbox]Element 1.2.1
[Checkbox]Element 1.2.2
[Checkbox]Element 2
[Checkbox]Element 2.1
[Checkbox]Element 2.2
[Checkbox]Element 2.2.1
[Checkbox]Element 2.2.2
但是,当我在本地运行它时:npm ERR! missing script: start
它运行正常。
项目成功建设。
我在package.json中设置了启动脚本:
heroku local web
根据文档,如果我没有指定Procfile,默认情况下应该"scripts": {
"start": "node server"
}
但是,我也尝试添加Procfile:
Procfile内容。
npm start
它会抛出相同的错误。
日志输出:web: npm start
heroku logs -a nypstest
的package.json
Niteshs-MacBook-Pro:nyps nitesh$ heroku logs -a nypstest
2016-06-15T07:01:44.024250+00:00 heroku[api]: Release v3 created by nitesh@campusdiaries.com
2016-06-15T07:01:44.023668+00:00 heroku[api]: Scale to web=1 by nitesh@campusdiaries.com
2016-06-15T07:01:44.429595+00:00 heroku[slug-compiler]: Slug compilation started
2016-06-15T07:01:44.429603+00:00 heroku[slug-compiler]: Slug compilation finished
2016-06-15T07:01:46.222149+00:00 heroku[web.1]: Starting process with command `npm start`
2016-06-15T07:01:49.138230+00:00 app[web.1]: npm ERR! Linux 3.13.0-85-generic
2016-06-15T07:01:49.141111+00:00 app[web.1]: npm ERR! npm v3.8.6
2016-06-15T07:01:49.139367+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-06-15T07:01:49.139986+00:00 app[web.1]: npm ERR! node v5.11.1
2016-06-15T07:01:49.160916+00:00 app[web.1]:
2016-06-15T07:01:49.145755+00:00 app[web.1]: npm ERR!
2016-06-15T07:01:49.146073+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-06-15T07:01:49.143580+00:00 app[web.1]:
2016-06-15T07:01:49.146389+00:00 app[web.1]: npm ERR! <https://github.com/npm/npm/issues>
2016-06-15T07:01:49.161685+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-06-15T07:01:49.161369+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-06-15T07:01:49.145444+00:00 app[web.1]: npm ERR! missing script: start
2016-06-15T07:01:50.132213+00:00 heroku[web.1]: Process exited with status 1
2016-06-15T07:01:50.152654+00:00 heroku[web.1]: State changed from crashed to starting
2016-06-15T07:01:50.151676+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-15T07:01:52.430686+00:00 heroku[web.1]: Starting process with command `npm start`
2016-06-15T07:01:55.754745+00:00 app[web.1]: npm ERR! node v5.11.1
2016-06-15T07:01:55.753213+00:00 app[web.1]: npm ERR! Linux 3.13.0-85-generic
2016-06-15T07:01:55.759649+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-06-15T07:01:55.754205+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-06-15T07:01:55.755673+00:00 app[web.1]: npm ERR! npm v3.8.6
2016-06-15T07:01:55.759409+00:00 app[web.1]: npm ERR!
2016-06-15T07:01:55.759143+00:00 app[web.1]: npm ERR! missing script: start
2016-06-15T07:01:55.757612+00:00 app[web.1]:
2016-06-15T07:01:55.759874+00:00 app[web.1]: npm ERR! <https://github.com/npm/npm/issues>
2016-06-15T07:01:55.772868+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-06-15T07:01:55.772730+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-06-15T07:01:55.772370+00:00 app[web.1]:
2016-06-15T07:01:56.675716+00:00 heroku[web.1]: Process exited with status 1
2016-06-15T07:01:56.687035+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-15T07:03:23.527948+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nypstest.herokuapp.com request_id=b064f04d-b6b8-4655-adc4-c4bbdb4db70a fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:03:26.783968+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nypstest.herokuapp.com request_id=dfa98acd-5291-46df-85e6-ec2d7bd1afa0 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:25:30.940961+00:00 heroku[web.1]: State changed from crashed to starting
2016-06-15T07:25:33.374221+00:00 heroku[web.1]: Starting process with command `npm start`
2016-06-15T07:25:35.711736+00:00 app[web.1]: npm ERR! Linux 3.13.0-85-generic
2016-06-15T07:25:35.712514+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-06-15T07:25:35.712824+00:00 app[web.1]: npm ERR! node v5.11.1
2016-06-15T07:25:35.713260+00:00 app[web.1]: npm ERR! npm v3.8.6
2016-06-15T07:25:35.714628+00:00 app[web.1]:
2016-06-15T07:25:35.716136+00:00 app[web.1]: npm ERR! missing script: start
2016-06-15T07:25:35.716418+00:00 app[web.1]: npm ERR!
2016-06-15T07:25:35.716638+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-06-15T07:25:35.716866+00:00 app[web.1]: npm ERR! <https://github.com/npm/npm/issues>
2016-06-15T07:25:35.726294+00:00 app[web.1]:
2016-06-15T07:25:35.726558+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-06-15T07:25:35.726717+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-06-15T07:25:36.541486+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-15T07:25:36.529432+00:00 heroku[web.1]: Process exited with status 1
2016-06-15T07:25:55.677715+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nypstest.herokuapp.com request_id=d67c3c7f-1b0c-4ae4-8066-f539c676c813 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:25:56.970694+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nypstest.herokuapp.com request_id=a5e959df-5c6b-475e-883d-668fffc3b1ca fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:37:15.873210+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nypstest.herokuapp.com request_id=83d3f406-22ba-4649-81c4-261889c6f26d fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:37:17.263994+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nypstest.herokuapp.com request_id=b24ecc40-99ed-4ee4-8975-850f02880751 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:40:31.730476+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nypstest.herokuapp.com request_id=46c7351c-6818-466c-b816-fab8686a3a26 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:40:32.902969+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nypstest.herokuapp.com request_id=a29d2281-9931-412d-befb-4788284e6dc3 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:40:46.425659+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nypstest.herokuapp.com request_id=69f32408-7b94-41ed-a692-3874bb87125e fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:40:47.283575+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nypstest.herokuapp.com request_id=82645270-a085-49f0-8bdd-8ffbd417e136 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:46:45.562741+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nypstest.herokuapp.com request_id=d6b356f1-e7f3-4e74-a9bc-7834b6ddaa39 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:46:46.792388+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nypstest.herokuapp.com request_id=0df4dfd9-5368-41b3-a658-37c80effc3c5 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T08:09:20.166494+00:00 heroku[web.1]: State changed from crashed to starting
2016-06-15T08:09:22.215228+00:00 heroku[web.1]: Starting process with command `npm start`
2016-06-15T08:09:25.009624+00:00 app[web.1]: npm ERR! Linux 3.13.0-85-generic
2016-06-15T08:09:25.010335+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-06-15T08:09:25.010667+00:00 app[web.1]: npm ERR! node v5.11.1
2016-06-15T08:09:25.011377+00:00 app[web.1]: npm ERR! npm v3.8.6
2016-06-15T08:09:25.013096+00:00 app[web.1]:
2016-06-15T08:09:25.014247+00:00 app[web.1]: npm ERR! missing script: start
2016-06-15T08:09:25.014442+00:00 app[web.1]: npm ERR!
2016-06-15T08:09:25.014622+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-06-15T08:09:25.014765+00:00 app[web.1]: npm ERR! <https://github.com/npm/npm/issues>
2016-06-15T08:09:25.025073+00:00 app[web.1]:
2016-06-15T08:09:25.025367+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-06-15T08:09:25.025542+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-06-15T08:09:25.854231+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-15T08:09:25.844519+00:00 heroku[web.1]: Process exited with status 1
2016-06-15T08:26:54.120685+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nypstest.herokuapp.com request_id=8e5dbaff-ba8a-4a2f-a4f5-b56e6aba2871 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T08:26:55.251426+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nypstest.herokuapp.com request_id=ada7aaf7-a2c6-4f98-b387-3f201102b09c fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T08:36:41.113185+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nypstest.herokuapp.com request_id=e412adc8-0d6f-45c9-b30d-06774366132e fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T08:36:42.534191+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nypstest.herokuapp.com request_id=bcc98a01-93d2-40b8-91ce-d59f67f54c7a fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T09:32:52.373988+00:00 heroku[web.1]: State changed from crashed to starting
2016-06-15T09:32:54.422584+00:00 heroku[web.1]: Starting process with command `npm start`
2016-06-15T09:32:57.749315+00:00 app[web.1]: npm ERR! Linux 3.13.0-85-generic
2016-06-15T09:32:57.751518+00:00 app[web.1]: npm ERR! npm v3.8.6
2016-06-15T09:32:57.753827+00:00 app[web.1]:
2016-06-15T09:32:57.755515+00:00 app[web.1]: npm ERR!
2016-06-15T09:32:57.750410+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-06-15T09:32:57.750924+00:00 app[web.1]: npm ERR! node v5.11.1
2016-06-15T09:32:57.755280+00:00 app[web.1]: npm ERR! missing script: start
2016-06-15T09:32:57.773805+00:00 app[web.1]:
2016-06-15T09:32:57.755821+00:00 app[web.1]: npm ERR! <https://github.com/npm/npm/issues>
2016-06-15T09:32:57.755662+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-06-15T09:32:57.774094+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-06-15T09:32:57.774273+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-06-15T09:32:58.841956+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-15T09:32:58.826851+00:00 heroku[web.1]: Process exited with status 1
2016-06-15T09:49:37.707537+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nypstest.herokuapp.com request_id=bc832c95-120e-4b59-ad83-7dd95f7081f8 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T09:49:39.156404+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nypstest.herokuapp.com request_id=0f6b252e-8e67-47b1-9c21-c41eea09e0ef fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
Niteshs-MacBook-Pro:nyps nitesh$
server.js
...app descriptions
"main": "index.js",
"scripts": {
"start": "node server"
},
...other dependencies
修改 完成Package.json
var webpack = require('webpack')
var webpackDevMiddleware = require('webpack-dev-middleware')
var webpackHotMiddleware = require('webpack-hot-middleware')
var config = require('./webpack.config')
var serveStatic = require('serve-static');
var sendMail = require('./src/api/sendmail');
var bodyParser = require('body-parser');
var app = new (require('express'))()
var port = process.env.WEBPACK_PORT || 3000
var compiler = webpack(config)
app.use(webpackDevMiddleware(compiler, { noInfo: true, publicPath: config.output.publicPath }))
app.use(webpackHotMiddleware(compiler))
// parse application/json
app.use(bodyParser.json());
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: true }));
app.get('*', function(req, res) {
res.sendFile(__dirname + '/index.html')
})
app.listen(port, function(error) {
if (error) {
console.error(error)
} else {
console.info("==> Listening on port %s. Open up http://localhost:%s/ in your browser.", port, port)
}
})
答案 0 :(得分:3)
你必须将package.json中的“main”更改为server.js
你也可以这样做:
"scripts": {
"start": "node server.js",
"test": "mocha",
"postinstall": "bower install && grunt build"
}
https://devcenter.heroku.com/articles/nodejs-support#customizing-the-build-process
https://scotch.io/tutorials/how-to-deploy-a-node-js-app-to-heroku
答案 1 :(得分:1)
我遇到了同样的问题,我的服务器在 app.js 文件上,我更改了 package.json 文件,如下所示:
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start" : "node app.js"
},
和 Procfile 为
web: node app.js
然后我重做 heroku 创建过程 heroku app create procedure
这是它的链接:https://devcenter.heroku.com/articles/deploying-nodejs#deploy-your-application-to-heroku
我认为这会有所帮助
答案 2 :(得分:0)
一切看起来都很正确。确保Procfile命名正确并且位于正确的文件夹中。
答案 3 :(得分:0)
问题可能出在文件的嵌套方式上。如果您有一个git存储库,其中有另一个包含代码的文件,则pa
答案 4 :(得分:0)
我的三个js名称和主js文件都一样,对我有用。
在package.json中。
"main": "app.js",
"scripts": {
"start": "node app.js"
}
和在Procfile中
web:node app.js