我将MERN应用程序部署到Heroku出了什么问题?

时间:2020-08-18 19:10:57

标签: node.js reactjs express heroku mern

我正尝试将MERN应用程序部署到Heroku,这是我的错误日志和package.json文件。谁能看到这是什么原因?我在弄清日志方面遇到麻烦。

2020-08-18T19:02:01.418730+00:00 app[web.1]: npm ERR! Failed at the mern-test@1.0.0 start:dev script.
2020-08-18T19:02:01.418905+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-18T19:02:01.460333+00:00 app[web.1]: 
2020-08-18T19:02:01.465165+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-18T19:02:01.465345+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2020-08-18T19_02_01_448Z-debug.log
2020-08-18T19:02:01.513257+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-08-18T19:02:01.513666+00:00 app[web.1]: npm ERR! errno 1
2020-08-18T19:02:01.518773+00:00 app[web.1]: npm ERR! mern-test@1.0.0 start: `if-env NODE_ENV=production && npm run start:prod || npm run start:dev`
2020-08-18T19:02:01.518992+00:00 app[web.1]: npm ERR! Exit status 1
2020-08-18T19:02:01.519232+00:00 app[web.1]: npm ERR!
2020-08-18T19:02:01.519442+00:00 app[web.1]: npm ERR! Failed at the mern-test@1.0.0 start script.
2020-08-18T19:02:01.519639+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-18T19:02:01.548584+00:00 app[web.1]: 
2020-08-18T19:02:01.548885+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-18T19:02:01.549093+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2020-08-18T19_02_01_529Z-debug.log
2020-08-18T19:02:01.616487+00:00 heroku[web.1]: Process exited with status 1
2020-08-18T19:02:01.665085+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-18T19:02:01.668346+00:00 heroku[web.1]: State changed from crashed to starting
2020-08-18T19:02:12.552667+00:00 heroku[web.1]: Starting process with command `npm start`
2020-08-18T19:02:15.353294+00:00 app[web.1]: 
2020-08-18T19:02:15.353325+00:00 app[web.1]: > mern-test@1.0.0 start /app
2020-08-18T19:02:15.353326+00:00 app[web.1]: > if-env NODE_ENV=production && npm run start:prod || npm run start:dev
2020-08-18T19:02:15.353326+00:00 app[web.1]: 
2020-08-18T19:02:15.968345+00:00 app[web.1]: 
2020-08-18T19:02:15.968361+00:00 app[web.1]: > mern-test@1.0.0 start:prod /app
2020-08-18T19:02:15.968361+00:00 app[web.1]: > node server.js
2020-08-18T19:02:15.968362+00:00 app[web.1]: 
2020-08-18T19:02:16.998859+00:00 app[web.1]: internal/modules/cjs/loader.js:968
2020-08-18T19:02:16.998874+00:00 app[web.1]: throw err;
2020-08-18T19:02:16.998875+00:00 app[web.1]: ^
2020-08-18T19:02:16.998875+00:00 app[web.1]: 
2020-08-18T19:02:16.998876+00:00 app[web.1]: Error: Cannot find module '../../controllers/theAudioDbController'
2020-08-18T19:02:16.998876+00:00 app[web.1]: Require stack:
2020-08-18T19:02:16.998877+00:00 app[web.1]: - /app/routes/api/index.js
2020-08-18T19:02:16.998877+00:00 app[web.1]: - /app/routes/index.js
2020-08-18T19:02:16.998877+00:00 app[web.1]: - /app/server.js
2020-08-18T19:02:16.998878+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
2020-08-18T19:02:16.998878+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:841:27)
2020-08-18T19:02:16.998879+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1025:19)
2020-08-18T19:02:16.998879+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:72:18)
2020-08-18T19:02:16.998880+00:00 app[web.1]: at Object.<anonymous> (/app/routes/api/index.js:2:30)
2020-08-18T19:02:16.998880+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1137:30)
2020-08-18T19:02:16.998880+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
2020-08-18T19:02:16.998881+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:985:32)
2020-08-18T19:02:16.998881+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:878:14)
2020-08-18T19:02:16.998881+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1025:19)
2020-08-18T19:02:16.998882+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:72:18)
2020-08-18T19:02:16.998882+00:00 app[web.1]: at Object.<anonymous> (/app/routes/index.js:3:19)
2020-08-18T19:02:16.998883+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1137:30)
2020-08-18T19:02:16.998883+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
2020-08-18T19:02:16.998884+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:985:32)
2020-08-18T19:02:16.998923+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:878:14) {
2020-08-18T19:02:16.998924+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2020-08-18T19:02:16.998925+00:00 app[web.1]: requireStack: [
2020-08-18T19:02:16.998925+00:00 app[web.1]: '/app/routes/api/index.js',
2020-08-18T19:02:16.998925+00:00 app[web.1]: '/app/routes/index.js',
2020-08-18T19:02:16.998926+00:00 app[web.1]: '/app/server.js'
2020-08-18T19:02:16.998926+00:00 app[web.1]: ]
2020-08-18T19:02:16.998927+00:00 app[web.1]: }
2020-08-18T19:02:17.021432+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-08-18T19:02:17.021861+00:00 app[web.1]: npm ERR! errno 1
2020-08-18T19:02:17.025837+00:00 app[web.1]: npm ERR! mern-test@1.0.0 start:prod: `node server.js`
2020-08-18T19:02:17.026037+00:00 app[web.1]: npm ERR! Exit status 1
2020-08-18T19:02:17.026255+00:00 app[web.1]: npm ERR!
2020-08-18T19:02:17.026335+00:00 app[web.1]: npm ERR! Failed at the mern-test@1.0.0 start:prod script.
2020-08-18T19:02:17.026396+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-18T19:02:17.033129+00:00 app[web.1]: 
2020-08-18T19:02:17.033396+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-18T19:02:17.033590+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2020-08-18T19_02_17_028Z-debug.log
2020-08-18T19:02:17.588460+00:00 app[web.1]: 
2020-08-18T19:02:17.588474+00:00 app[web.1]: > mern-test@1.0.0 start:dev /app
2020-08-18T19:02:17.588475+00:00 app[web.1]: > concurrently "nodemon --ignore 'client/*'" "npm run client"
2020-08-18T19:02:17.588476+00:00 app[web.1]: 
2020-08-18T19:02:17.597996+00:00 app[web.1]: sh: 1: concurrently: not found
2020-08-18T19:02:17.617437+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-08-18T19:02:17.618167+00:00 app[web.1]: npm ERR! syscall spawn
2020-08-18T19:02:17.618426+00:00 app[web.1]: npm ERR! file sh
2020-08-18T19:02:17.618677+00:00 app[web.1]: npm ERR! errno ENOENT
2020-08-18T19:02:17.623336+00:00 app[web.1]: npm ERR! mern-test@1.0.0 start:dev: `concurrently "nodemon --ignore 'client/*'" "npm run client"`
2020-08-18T19:02:17.623493+00:00 app[web.1]: npm ERR! spawn ENOENT
2020-08-18T19:02:17.623658+00:00 app[web.1]: npm ERR!
2020-08-18T19:02:17.623829+00:00 app[web.1]: npm ERR! Failed at the mern-test@1.0.0 start:dev script.
2020-08-18T19:02:17.623976+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-18T19:02:17.630596+00:00 app[web.1]: 
2020-08-18T19:02:17.630799+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-18T19:02:17.630952+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2020-08-18T19_02_17_626Z-debug.log
2020-08-18T19:02:17.657848+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-08-18T19:02:17.658272+00:00 app[web.1]: npm ERR! errno 1
2020-08-18T19:02:17.663230+00:00 app[web.1]: npm ERR! mern-test@1.0.0 start: `if-env NODE_ENV=production && npm run start:prod || npm run start:dev`
2020-08-18T19:02:17.663456+00:00 app[web.1]: npm ERR! Exit status 1
2020-08-18T19:02:17.663695+00:00 app[web.1]: npm ERR!
2020-08-18T19:02:17.663882+00:00 app[web.1]: npm ERR! Failed at the mern-test@1.0.0 start script.
2020-08-18T19:02:17.664063+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-18T19:02:17.671333+00:00 app[web.1]: 
2020-08-18T19:02:17.671650+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-18T19:02:17.671850+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2020-08-18T19_02_17_666Z-debug.log
2020-08-18T19:02:17.746107+00:00 heroku[web.1]: Process exited with status 1
2020-08-18T19:02:17.785792+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-18T19:02:20.046326+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=merntest.herokuapp.com request_id=ac795fc0-7677-4528-8f27-2f05a5f81912 fwd="99.9.203.7" dyno= connect= service= status=503 bytes= protocol=https
2020-08-18T19:02:21.701159+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=merntest.herokuapp.com request_id=288cf6cd-cff6-4943-9a89-b51bd0e8b8af fwd="99.9.203.7" dyno= connect= service= status=503 bytes= protocol=https

这是我的package.json文件:

{
  "name": "mern-test",
  "version": "1.0.0",
  "description": "",
  "main": "server.js",
  "scripts": {
    "start": "if-env NODE_ENV=production && npm run start:prod || npm run start:dev",
    "start:prod": "node server.js",
    "start:dev": "concurrently \"nodemon --ignore 'client/*'\" \"npm run client\"",
    "client": "cd client && npm run start",
    "install": "cd client && npm install",
    "build": "cd client && npm run build",
    "heroku-postbuild": "npm run install && npm run build "
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "axios": "^0.19.2",
    "bcryptjs": "^2.4.3",
    "express": "^4.17.1",
    "express-session": "^1.17.1",
    "if-env": "^1.0.4",
    "moment": "^2.27.0",
    "mongoose": "^5.9.25",
    "morgan": "^1.10.0",
    "passport": "^0.4.1",
    "passport-local": "^1.0.0",
    "path": "^0.12.7",
    "react-datepicker": "^3.1.3",
    "react-router-dom": "^5.2.0",
    "react-star-ratings": "^2.3.0",
    "router": "^1.3.5"
  },
  "devDependencies": {
    "concurrently": "^4.1.0",
    "nodemon": "^2.0.4"
  }
}

如果您看到明显不对的地方,或者可能如何继续解决此问题,请告诉我。我不确定从哪里开始。谢谢。

1 个答案:

答案 0 :(得分:2)

错误显示Error: Cannot find module '../../controllers/theAudioDbController'。检查文件名是否正确。