Node JS后端中的永久软件包问题

时间:2020-01-14 13:50:31

标签: node.js amazon-ec2 forever

以前我有nodemon,但是它不能正常工作,所以我安装了Forever软件包,以便在更改后继续更新服务器文件。但是它一直崩溃,我不知道原因b'z我是Node js项目的新手。

Forever V2.0.0和Node V13.1

Package.json

{
  "name": "app-backend",
  "version": "1.0.0",
  "description": "",
  "main": "main.js",
  "scripts": {
    "start": "node main.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "aws-sdk": "^2.573.0",
    "bcrypt-nodejs": "0.0.3",
    "body-parser": "^1.18.3",
    "cors": "^2.8.5",
    "express": "^4.16.3",
    "express-validator": "^5.3.0",
    "helmet": "^3.21.2",
    "jsonwebtoken": "^8.4.0",
    "mongoose": "^5.2.13",
    "morgan": "^1.9.1",
    "node-geocoder": "^3.24.0",
    "passport": "^0.4.0",
    "passport-jwt": "^4.0.0"
  }
}

请告诉我此错误的原因是什么,我该如何解决。

error: Script restart attempt #11
(node:6770) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
events.js:187
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use :::3000
    at Server.setupListenHandle [as _listen2] (net.js:1301:14)
    at listenInCluster (net.js:1349:12)
    at Server.listen (net.js:1437:7)
    at Function.listen (/home/.../node_modules/express/lib/application.js:618:24)
    at Object.<anonymous> (/home/.../main.js:81:5)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1103:10)
    at Module.load (internal/modules/cjs/loader.js:914:32)
    at Function.Module._load (internal/modules/cjs/loader.js:822:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1143:12)
    at internal/main/run_main_module.js:16:11
Emitted 'error' event on Server instance at:
    at emitErrorNT (net.js:1328:8)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  code: 'EADDRINUSE',
  errno: -98,
  syscall: 'listen',
  address: '::',
  port: 3000
}
error: Forever detected script exited with code: 1

npm日志

12 info lifecycle app-backend@1.0.0~start: Failed to exec start script
13 verbose stack Error: app-backend@1.0.0 start: `node main.js`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/home/user/.nvm/versions/node/v13.1.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:210:5)
13 verbose stack     at ChildProcess.<anonymous> (/home/user/.nvm/versions/node/v13.1.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:210:5)
13 verbose stack     at maybeClose (internal/child_process.js:1028:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)

0 个答案:

没有答案