Heroku Web:NPM错误!缺少脚本:开始



heroku web投掷错误: npm ERR! missing script: start

但是,当我本地运行它时:heroku local web它可以正常运行。项目已成功构建。

我已经在我的软件包中设置了启动脚本。JSONAS:

"scripts": {
    "start": "node server"
  }

根据文档,如果我不指定procfile,则默认情况下应为npm start

但是,我也尝试添加procfile:

procfile内容。

web: npm start

它引发了相同的错误。

日志输出:heroku logs -a nypstest

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$ 

package.json

  ...app descriptions
  "main": "index.js",
  "scripts": {
    "start": "node server"
  },
  ...other dependencies

server.js

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)
  }
})

编辑:完整软件包。JSON

{
  "name": "App_Name",
  "version": "1.0.0",
  "description": "Some-Discription",
  "keywords": [
    "redux",
    "react",
    "router",
    "routing",
    "frontend",
    "client",
    "webpack",
    "babel",
    "sass",
    "foundation",
    "postcss"
  ],
  "main": "index.js",
  "scripts": {
    "start": "node server.js",
    "test": "mocha",
    "postinstall": "bower install && grunt build"
  },
  "author": "Nitesh",
  "license": "ISC",
  "dependencies": {
    "axios": "^0.11.1",
    "body-parser": "^1.15.1",
    "classnames": "^2.2.0",
    "connect": "^3.4.1",
    "firebase": "^3.0.3",
    "firebase-token-generator": "^2.0.0",
    "font-awesome": "^4.3.0",
    "foundation-sites": "^6.1.2",
    "json-loader": "^0.5.4",
    "mongodb": "^2.1.20",
    "mongoose": "^4.4.19",
    "react": "^0.14.5",
    "react-addons-update": "^0.14.7",
    "react-autosuggest": "^3.7.4",
    "react-dom": "^0.14.7",
    "react-modal": "^1.3.0",
    "react-router": "2.0.0-rc5",
    "react-router-redux": "^2.1.0",
    "react-simple-autocomplete": "^1.0.2",
    "redux": "^3.2.1",
    "redux-form": "^5.2.5",
    "redux-logger": "^2.5.2",
    "redux-thunk": "^1.0.3",
    "request": "^2.65.0",
    "rethinkdb": "^2.3.1",
    "sendgrid": "^2.0.0",
    "underscore": "^1.8.3",
    "what-input": "^1.1.4"
  },
  "optionalDependencies": {},
  "devDependencies": {
    "autoprefixer": "^6.3.2",
    "babel-core": "^6.3.15",
    "babel-loader": "^6.2.0",
    "babel-plugin-transform-runtime": "^6.5.0",
    "babel-preset-es2015": "^6.3.13",
    "babel-preset-react": "^6.3.13",
    "babel-preset-react-hmre": "^1.0.1",
    "babel-preset-stage-0": "^6.5.0",
    "babel-runtime": "^6.9.0",
    "css-loader": "^0.23.1",
    "express": "^4.13.3",
    "extract-text-webpack-plugin": "^1.0.1",
    "file-loader": "^0.8.5",
    "jquery": "^2.2.4",
    "node-sass": "^3.4.2",
    "postcss-loader": "^0.8.0",
    "react-redux": "^4.4.5",
    "redux-devtools": "^3.1.0",
    "redux-devtools-dock-monitor": "^1.0.1",
    "redux-devtools-log-monitor": "^1.0.3",
    "sass-loader": "^3.1.2",
    "script-loader": "^0.6.1",
    "serve-static": "^1.10.2",
    "style-loader": "^0.13.0",
    "url-loader": "^0.5.7",
    "webpack": "^1.9.11",
    "webpack-dev-middleware": "^1.2.0",
    "webpack-hot-middleware": "^2.2.0"
  }
}

您必须在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-node-js-app-to-heroku

我遇到了相同的问题,我的服务器在app.js文件上,我更改了我的package.json文件如下:

"main": "app.js",
"scripts": {
    "test": "echo "Error: no test specified" && exit 1",
    "start" : "node app.js"
  },

和procfile as

web: node app.js

我重做了Heroku创建程序Heroku应用程序创建过程

这是它的链接:https://devcenter.heroku.com/articles/deploying-nodejs#deploy-your-your-application-to-heroku

我认为这将有用

一切看起来都正确。确保procfile正确命名并在正确的文件夹中。

有可能问题嵌套的问题。如果您有一个带有代码的文件的git存储库,则PA

我具有三个JS相同名称,而我的主JS文件对我有用。

in package.json。
"main": "app.js", "scripts": { "start": "node app.js" }

和procfile
web:node app.js

相关内容

  • 没有找到相关文章

最新更新