0
votes

2020-01-28T01:42:46.028688+00:00 heroku[web.1]: Starting process with command npm start

2020-01-28T01:42:45.000000+00:00 app[api]: Build succeeded

2020-01-28T01:42:48.451589+00:00 heroku[web.1]: State changed from starting to crashed

2020-01-28T01:42:48.433700+00:00 heroku[web.1]: Process exited with status 1

2020-01-28T01:42:48.377550+00:00 app[web.1]: npm ERR! missing script: start

2020-01-28T01:42:48.385902+00:00 app[web.1]:

2020-01-28T01:42:48.386316+00:00 app[web.1]: npm ERR! A complete log of this run can be found

in: 2020-01-28T01:42:48.386539+00:00 app[web.1]: npm ERR!
/app/.npm/_logs/2020-01-

28T01_42_48_378Z-debug.log

2020-01-28T01:42:49.724030+00:00 heroku[router]: at=error code=H10 desc="App crashed"

method=GET path="/" host=hyperrestaurant.herokuapp.com request_id=df2c429e-7b27-40d5-93b4-

a63f4b15c8fe fwd="146.115.31.86" dyno= connect= service= status=503 bytes= protocol=https

2020-01-28T01:42:50.003622+00:00 heroku[router]: at=error code=H10 desc="App crashed"

method=GET path="/favicon.ico" host=hyperrestaurant.herokuapp.com request_id=c1f6be2c-35da-

4e86-97b1-59fa73eb91fb fwd="146.115.31.86" dyno= connect= service= status=503 bytes=

protocol=https

my package.json

{
  "name": "HyperApp-Starter-kit",

  "version": "4.0.1",

  "description": "",

  "main": "index.js",

  "scripts": {

    "node": "index.js",

    "test": "jest",

    "build": "gulp build",

    "dev:webpack": "webpack --mode development --env.NODE_ENV=dev",

    "build:webpack": "webpack --mode production --env.NODE_ENV=production",

    "watch": "gulp",

    "proxy": "gulp watch-proxy",

    "static:dev": "gulp static-dev",

    "static:build": "gulp static-dev",

    "imgs": "gulp imagemin"

  },

and this is my server.js could this be a file placement issue html and css are placed in my assets file.

const express = require('express')

const serveStatic = require('serve-static')

const path = require('path')

// create the express app

const app = express()

// create middleware to handle the serving the app

app.use("/", serveStatic ( path.join (__dirname, '/public')))

// serve index by default

app.get('/', function (req, res) {

  res.sendFile(__dirname + '/public/index.html')

})
// Create default port to serve the app on

const port = process.env.PORT || 5000

app.listen(port)

// Log to feedback that this is actually running

console.log('Server started on port ' + port)
1

1 Answers

1
votes

Try adding into your package.json in the "scripts" object a start script as described here.

It should look something like this:

{
  "name": "HyperApp-Starter-kit",
  "version": "4.0.1",
  "description": "",
  "main": "index.js",
  "scripts": {
      "start" : "node server.js"
      ...

The ... is meant to signify that this is just part of your package.json, I don't literally mean type ....

This assumes that you can run your app using the command node server.js (since you mentioned that your file was called server.js).