javascript - Node.js 中的 NPM 错误

标签 javascript node.js mongodb heroku

我正在尝试成功部署在 Heroku 上的 Todo 路由,但显示应用程序错误。检查 Heroku 日志文件时,它显示日志文件中提到的以下错误

我已使用 node.js mongodb mongooseHerokumlab 进行部署

Node 版本

Node 版本 Node :8.11.2

日志文件

2018-06-23T10:53:43.168794+00:00 app[web.1]: npm ERR! spawn ENOENT
2018-06-23T10:53:43.169086+00:00 app[web.1]: npm ERR!
2018-06-23T10:53:43.169299+00:00 app[web.1]: npm ERR! Failed at the nodetodo@1.0.0 prestart script.
2018-06-23T10:53:43.169500+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2018-06-23T10:53:43.174385+00:00 app[web.1]:
2018-06-23T10:53:43.174622+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-06-23T10:53:43.174799+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2018-06-23T10_53_43_171Z-debug.log
2018-06-23T10:53:43.275561+00:00 heroku[web.1]: State changed from crashed to starting
2018-06-23T10:53:46.634454+00:00 heroku[web.1]: Starting process with command `npm start`
2018-06-23T10:53:49.572029+00:00 heroku[web.1]: Process exited with status 1
2018-06-23T10:53:49.589326+00:00 heroku[web.1]: State changed from starting to crashed
2018-06-23T10:53:49.452654+00:00 app[web.1]:
2018-06-23T10:53:49.452675+00:00 app[web.1]: > nodetodo@1.0.0 prestart /app
2018-06-23T10:53:49.452677+00:00 app[web.1]: > next build
2018-06-23T10:53:49.452678+00:00 app[web.1]:
2018-06-23T10:53:49.461849+00:00 app[web.1]: sh: 1: next: not found
2018-06-23T10:53:49.476477+00:00 app[web.1]: npm ERR! file sh
2018-06-23T10:53:49.476762+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2018-06-23T10:53:49.477051+00:00 app[web.1]: npm ERR! errno ENOENT
2018-06-23T10:53:49.477332+00:00 app[web.1]: npm ERR! syscall spawn
2018-06-23T10:53:49.479006+00:00 app[web.1]: npm ERR! nodetodo@1.0.0 prestart: `next build`
2018-06-23T10:53:49.479274+00:00 app[web.1]: npm ERR! spawn ENOENT
2018-06-23T10:53:49.479567+00:00 app[web.1]: npm ERR!
2018-06-23T10:53:49.479782+00:00 app[web.1]: npm ERR! Failed at the nodetodo@1.0.0 prestart script.
2018-06-23T10:53:49.479988+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2018-06-23T10:53:49.488380+00:00 app[web.1]:
2018-06-23T10:53:49.488650+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-06-23T10:53:49.488830+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2018-06-23T10_53_49_481Z-debug.log
2018-06-23T10:53:57.235315+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/todos" host=glacial-mesa-32050.herokuapp.com request_id=0cbc6b93-45b5-4e60-a716-6e87f9cfe8b5 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:53:57.875585+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-mesa-32050.herokuapp.com request_id=8a8c1304-b9ca-4684-8306-a70dca54e911 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:54:00.250909+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/todos" host=glacial-mesa-32050.herokuapp.com request_id=d4de12e1-d453-4a62-9ee0-4a99e2f78051 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:54:00.896607+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-mesa-32050.herokuapp.com request_id=8e52a8d5-2bd2-4e95-a8e6-7e43c21bd369 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:54:04.255637+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/todos" host=glacial-mesa-32050.herokuapp.com request_id=8d68216f-f176-4f79-91b5-cb10b02c8fc3 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:54:04.866164+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-mesa-32050.herokuapp.com request_id=5ebf6203-d866-42ff-baf7-f57179248c73 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:54:06.844189+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/todos" host=glacial-mesa-32050.herokuapp.com request_id=11ce1294-b8a5-4046-ad2b-1db482422355 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:54:07.474661+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-mesa-32050.herokuapp.com request_id=98c0098c-c969-4491-99d3-aa6f29eb836f fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:57:10.708198+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=glacial-mesa-32050.herokuapp.com request_id=b3fc81b7-4a7a-438c-8482-e0b68b8e52d0 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:57:11.197790+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-mesa-32050.herokuapp.com request_id=b8c7fff9-7304-4e63-8fea-50d9e7525cf2 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:57:21.844958+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/todos" host=glacial-mesa-32050.herokuapp.com request_id=b0fa0c40-3fed-4da9-b680-6b55864ae418 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:57:24.013893+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-mesa-32050.herokuapp.com request_id=8b0ac5ed-ea76-4ee4-b1a8-99ba8520c986 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T11:05:45.000000+00:00 app[api]: Build started by user @gmail.com
2018-06-23T11:05:58.286485+00:00 app[api]: Deploy 6ab35c64 by user @gmail.com
2018-06-23T11:05:58.286485+00:00 app[api]: Release v5 created by user @gmail.com
2018-06-23T11:05:58.000000+00:00 app[api]: Build succeeded
2018-06-23T11:06:00.741880+00:00 heroku[web.1]: State changed from crashed to starting
2018-06-23T11:06:04.111616+00:00 heroku[web.1]: Starting process with command `npm start`
2018-06-23T11:06:06.707945+00:00 app[web.1]:
2018-06-23T11:06:06.707971+00:00 app[web.1]: > nodetodo@1.0.0 start /app
2018-06-23T11:06:06.707972+00:00 app[web.1]: > node server/server.js
2018-06-23T11:06:06.707974+00:00 app[web.1]:
2018-06-23T11:06:07.594283+00:00 app[web.1]: Started at port 38896
2018-06-23T11:06:07.622294+00:00 app[web.1]:
2018-06-23T11:06:07.622298+00:00 app[web.1]: /app/node_modules/mongoose/node_modules/mongodb/lib/server.js:242
2018-06-23T11:06:07.622300+00:00 app[web.1]: process.nextTick(function() { throw err; })
2018-06-23T11:06:07.622302+00:00 app[web.1]: ^
2018-06-23T11:06:07.622338+00:00 app[web.1]: Error: connect ECONNREFUSED 127.0.0.1:27017
2018-06-23T11:06:07.622340+00:00 app[web.1]: at Object._errnoException (util.js:992:11)
2018-06-23T11:06:07.622342+00:00 app[web.1]: at _exceptionWithHostPort (util.js:1014:20)
2018-06-23T11:06:07.622344+00:00 app[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)
2018-06-23T11:06:07.632652+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2018-06-23T11:06:07.633131+00:00 app[web.1]: npm ERR! errno 1
2018-06-23T11:06:07.634834+00:00 app[web.1]: npm ERR! nodetodo@1.0.0 start: `node server/server.js`
2018-06-23T11:06:07.635359+00:00 app[web.1]: npm ERR!
2018-06-23T11:06:07.635590+00:00 app[web.1]: npm ERR! Failed at the nodetodo@1.0.0 start script.
2018-06-23T11:06:07.635057+00:00 app[web.1]: npm ERR! Exit status 1
2018-06-23T11:06:07.635807+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2018-06-23T11:06:07.642357+00:00 app[web.1]:
2018-06-23T11:06:07.642642+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-06-23T11:06:07.642830+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2018-06-23T11_06_07_637Z-debug.log
2018-06-23T11:06:07.695625+00:00 heroku[web.1]: Process exited with status 1
2018-06-23T11:06:07.822414+00:00 heroku[web.1]: State changed from starting to crashed
2018-06-23T11:06:07.826000+00:00 heroku[web.1]: State changed from crashed to starting
2018-06-23T11:06:10.546996+00:00 heroku[web.1]: Starting process with command `npm start`
2018-06-23T11:06:12.650782+00:00 app[web.1]:
2018-06-23T11:06:12.650804+00:00 app[web.1]: > nodetodo@1.0.0 start /app
2018-06-23T11:06:12.650806+00:00 app[web.1]: > node server/server.js
2018-06-23T11:06:12.650807+00:00 app[web.1]:
2018-06-23T11:06:13.248399+00:00 app[web.1]: Started at port 4126
2018-06-23T11:06:13.264689+00:00 app[web.1]:
2018-06-23T11:06:13.264697+00:00 app[web.1]: process.nextTick(function() { throw err; })
2018-06-23T11:06:13.264695+00:00 app[web.1]: /app/node_modules/mongoose/node_modules/mongodb/lib/server.js:242
2018-06-23T11:06:13.264699+00:00 app[web.1]: ^
2018-06-23T11:06:13.264700+00:00 app[web.1]: Error: connect ECONNREFUSED 127.0.0.1:27017
2018-06-23T11:06:13.264701+00:00 app[web.1]: at Object._errnoException (util.js:992:11)
2018-06-23T11:06:13.264703+00:00 app[web.1]: at _exceptionWithHostPort (util.js:1014:20)
2018-06-23T11:06:13.264705+00:00 app[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)
2018-06-23T11:06:13.271195+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2018-06-23T11:06:13.271503+00:00 app[web.1]: npm ERR! errno 1
2018-06-23T11:06:13.272534+00:00 app[web.1]: npm ERR! nodetodo@1.0.0 start: `node server/server.js`
2018-06-23T11:06:13.272816+00:00 app[web.1]: npm ERR!
2018-06-23T11:06:13.272926+00:00 app[web.1]: npm ERR! Failed at the nodetodo@1.0.0 start script.
2018-06-23T11:06:13.272642+00:00 app[web.1]: npm ERR! Exit status 1
2018-06-23T11:06:13.273028+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2018-06-23T11:06:13.276839+00:00 app[web.1]:
2018-06-23T11:06:13.276972+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-06-23T11:06:13.277055+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2018-06-23T11_06_13_274Z-debug.log
2018-06-23T11:06:13.324927+00:00 heroku[web.1]: Process exited with status 1
2018-06-23T11:06:13.471063+00:00 heroku[web.1]: State changed from starting to crashed
2018-06-23T11:06:20.993262+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=glacial-mesa-32050.herokuapp.com request_id=6458108b-77d2-485c-ba53-9e523f8fff7f fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T11:06:21.472089+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-mesa-32050.herokuapp.com request_id=dc99750e-aaba-4fc9-b7f5-fde727eb6201 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https

JSON 文件

{
  "name": "nodetodo",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node server/server.js",
    "test": "mocha server/**/*.test.js",
    "test-watch": "nodemon --exec \"npm test\""
  },
  "engines": {
    "node": "8.11.2"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "body-parser": "^1.18.3",
    "express": "^4.16.3",
    "mongodb": "^2.2.35",
    "mongoose": "^4.5.9"
  },
  "devDependencies": {
    "expect": "^1.20.2",
    "mocha": "^3.0.2",
    "nodemon": "^1.10.2",
    "supertest": "^2.0.0"
  }
}

请帮忙

最佳答案

您尝试过 npm cache clean -f 吗?

关于javascript - Node.js 中的 NPM 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51000979/

相关文章:

javascript - useInterval 和 React hooks 的问题 - 无限循环

node.js - MongoDB 按相关性排序

javascript - fabric.js - 重新调整尺寸后获得新高度

javascript - 单击淡出的音频音量?

javascript - 窗口调整大小事件上的响应式 Canvas

javascript - TypeError : PUBNUB. init 不是一个函数

javascript - 为什么我的页面会重新加载,即使我有 event.preventDefault (表单处理 jquery + node.js)

javascript - iOS 上的事件 'onDeviceMotion' 有任何限制吗?

java - 创建 Query like "A is "b"and C is '' "(Spring Boot/Spring Data w/Mongo)

mongodb - 我如何将 bson.M 元素列表组合成单个 bson.M 在 golang 的 mongo 中?