Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 应用程序在Heroku中崩溃/在Localhost中工作_Javascript_Node.js_Heroku - Fatal编程技术网

Javascript 应用程序在Heroku中崩溃/在Localhost中工作

Javascript 应用程序在Heroku中崩溃/在Localhost中工作,javascript,node.js,heroku,Javascript,Node.js,Heroku,我有一个应用程序在heroku中运行,它也是数据库。看起来一切正常,但应用程序崩溃了。我的终端没有任何错误。我从heroku那里得到的唯一东西就是这个 2021-04-06T02:07:13.448162+00:00 app[web.1]: > violet_vines@2.0.0 start 2021-04-06T02:07:13.448163+00:00 app[web.1]: > node server 2021-04-06T02:07:13.448163+00:00 app[

我有一个应用程序在heroku中运行,它也是数据库。看起来一切正常,但应用程序崩溃了。我的终端没有任何错误。我从heroku那里得到的唯一东西就是这个

2021-04-06T02:07:13.448162+00:00 app[web.1]: > violet_vines@2.0.0 start
2021-04-06T02:07:13.448163+00:00 app[web.1]: > node server
2021-04-06T02:07:13.448163+00:00 app[web.1]: 
2021-04-06T02:07:14.115150+00:00 heroku[web.1]: Process exited with status 0
2021-04-06T02:07:14.177976+00:00 heroku[web.1]: State changed from starting to crashed
Disconnected from log stream. There may be events happening that you do not see here! Attempting to reconnect...
2021-04-06T09:26:43.558948+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=violet-vines.herokuapp.com request_id=00a40ed1-4617-42d9-a984-f65f1e39160a fwd="77.88.5.215" dyno= connect= service= status=503 bytes= protocol=https
在Server index.js中:

const startListening = () => {
  // start listening (and create a 'server' object representing our server)
  const server = app.listen(PORT, () =>
    console.log(`Mixing it up on port ${PORT}`)
  )

  // set up our socket control center
  const io = socketio(server)
  require('./socket')(io)
}

const syncDb = () => db.sync()

async function bootApp() {
  await sessionStore.sync()
  await syncDb()
  await createApp()
  await startListening()
}
// This evaluates as true when this file is run directly from the command line,
// i.e. when we say 'node server/index.js' (or 'nodemon server/index.js', or 'nodemon server', etc)
// It will evaluate false when this module is required by another module - for example,
// if we wanted to require our app in a test spec
if (require.main === module) {
  bootApp()
} else {
  createApp()
}
在Package.json中:

  "scripts": {
    "build-client": "webpack",
    "build-client-watch": "webpack -w",
    "deploy": "script/deploy",
    "heroku-token": "script/encrypt-heroku-auth-token.js",
    "lint": "eslint ./ --ignore-path .gitignore",
    "lint-fix": "npm run lint -- --fix",
    "prepare": "if [ -d .git ]; then npm-merge-driver install; fi",
    "prettify": "prettier --write \"**/*.{js,jsx,json,css,scss,md}\"",
    "postinstall": "touch secrets.js",
    "seed": "node script/seed.js",
    "start": "node server",
    "start-dev": "NODE_ENV='production' npm run build-client-watch & NODE_ENV='production' npm run start-server",
    "start-server": "nodemon server -e html,js,scss --ignore public --ignore client",
    "test": "NODE_ENV='test' mocha \"./server/**/*.spec.js\" \"./client/**/*.spec.js\" \"./script/**/*.spec.js\" --require @babel/polyfill --require @babel/register"
  }

嗨,欢迎来到StackOverflow!请将您的代码作为代码而不是截图发布。对不起,我做了更改