首页
Javascript
Html
Css

Node.js

Electron
移动开发
小程序
工具类
服务端
浏览器相关
前端收藏
其他
关于
公司注册

eggjs启动报spawn tail ENOENT错误

2018年10月12日 发布 阅读(10394) 作者:Jerman

启动eggjs npm run start报错,而使用npm run dev没问题

开发电脑使用的window 7,习惯使用系统自带的cmd执行相关命令,抛出如下错误:

  1. [egg-scripts] Run node D:\project\imqianduan.com\node_modules\egg-scripts\lib\start-cluster {"port":7000,"title":"egg-server-imqianduan.com","framework":"D:\\project\\imqianduan.com\\node_modules\\egg","baseDir":"D:\\project\\imqianduan.com"} --title=egg-server-imqianduan.com
  2. [egg-scripts] Save log file to C:\Users\88888\logs
  3. [egg-scripts] Wait Start: 1...
  4. [egg-scripts] Wait Start: 2...
  5. [egg-scripts] Wait Start: 3...
  6. [egg-scripts] Wait Start: 4...
  7. [egg-scripts] Wait Start: 5...
  8. [egg-scripts] Wait Start: 6...
  9. [egg-scripts] tail -n 100 C:\Users\88888\logs\master-stderr.log
  10. [egg-scripts] ignore tail error: Error: spawn tail ENOENT
  11. [egg-scripts] Start got error, see C:\Users\88888\logs\master-stderr.log
  12. [egg-scripts] Or use `--ignore-stderr` to ignore stderr at startup.

依建议,取消了--ignore-stderr了,重新启动npm run start
貌似也没有启动成功,也没有具体的错误提示

  1. [egg-scripts] Run node D:\project\imqianduan.com\node_modules\egg-scripts\lib\start-cluster {"port":7000,"title":"egg-server-imqianduan.com","framework":"D:\\project\\imqianduan.com\\node_modules\\egg","baseDir":"D:\\project\\imqianduan.com"} --title=egg-server-imqianduan.com
  2. [egg-scripts] Save log file to C:\Users\88888\logs
  3. [egg-scripts] Wait Start: 1...
  4. [egg-scripts] Wait Start: 2...
  5. [egg-scripts] Wait Start: 3...
  6. [egg-scripts] Wait Start: 4...
  7. [egg-scripts] Wait Start: 5...
  8. [egg-scripts] Wait Start: 6...
  9. [egg-scripts] tail -n 100 C:\Users\88888\logs\master-stderr.log
  10. [egg-scripts] ignore tail error: Error: spawn tail ENOENT
  11. [egg-scripts] Start got error, see C:\Users\88888\logs\master-stderr.log
  12. [egg-scripts] Or use `--ignore-stderr` to ignore stderr at startup.
  13. npm ERR! code ELIFECYCLE
  14. npm ERR! errno 1
  15. npm ERR! imqianduan.com@1.0.0 start: `egg-scripts start --daemon --port 7000`
  16. npm ERR! Exit status 1
  17. npm ERR!
  18. npm ERR! Failed at the imqianduan.com@1.0.0 start script.
  19. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  20. npm ERR! A complete log of this run can be found in:
  21. npm ERR! C:\Users\88888\AppData\Roaming\npm-cache\_logs\2018-10-12T10_52_13_219Z-debug.log

通过上面可以看到,有一个错误spawn tail ENOENT,start没有启动成功,什么原因呢?

百度出来各种重复的答复的,解决不了问题。google spawn tail ENOENT第一条
https://github.com/mthenw/frontail/issues/81,启发是不是cmd的问题?

使用git 执行npm run start

牛逼了,错误信息出来了,很明显,redis密码错误

  1. [egg-scripts] Run node D:\project\imqianduan.com\node_modules\egg-scripts\lib\start-cluster {"port":7000,"title":"egg-server-imqianduan.com","framework":"D:\\project\\imqianduan.com\\node_modules\\egg","baseDir":"D:\\project\\imqianduan.com"} --title=egg-server-imqianduan.com
  2. [egg-scripts] Save log file to C:\Users\88888\logs
  3. [egg-scripts] Wait Start: 1...
  4. [egg-scripts] Wait Start: 2...
  5. [egg-scripts] Wait Start: 3...
  6. [egg-scripts] Wait Start: 4...
  7. [egg-scripts] Wait Start: 5...
  8. [egg-scripts] tail -n 100 C:\Users\88888\logs\master-stderr.log
  9. [egg-scripts] Got error when startup:
  10. [egg-scripts] 2018-10-12 18:29:11,209 ERROR 7752 nodejs.ReplyError: ERR invalid password
  11. [egg-scripts] at JavascriptReplyParser.returnError (D:\project\imqianduan.com\node_modules\ioredis\lib\redis\parser.js:25:25)
  12. [egg-scripts] at JavascriptReplyParser.run (D:\project\imqianduan.com\node_modules\redis-parser\lib\javascript.js:135:18)
  13. [egg-scripts] at JavascriptReplyParser.execute (D:\project\imqianduan.com\node_modules\redis-parser\lib\javascript.js:112:10)
  14. [egg-scripts] at Socket.<anonymous> (D:\project\imqianduan.com\node_modules\ioredis\lib\redis\event_handler.js:107:22)
  15. [egg-scripts] at emitOne (events.js:116:13)
  16. [egg-scripts] at Socket.emit (events.js:211:7)
  17. [egg-scripts] at addChunk (_stream_readable.js:263:12)
  18. [egg-scripts] at readableAddChunk (_stream_readable.js:250:11)
  19. [egg-scripts] at Socket.Readable.push (_stream_readable.js:208:10)
  20. [egg-scripts] at TCP.onread (net.js:607:20)
  21. [egg-scripts] name: "ReplyError"
  22. [egg-scripts] message: "ERR invalid password"
  23. [egg-scripts] command: {"name":"auth","args":["abcd987654321"]}
  24. [egg-scripts] pid: 7752
  25. [egg-scripts] hostname: XNZX-PC-103
  26. [egg-scripts]
  27. [egg-scripts] Db.prototype.authenticate method will no longer be available in the next major release 3.x as MongoDB 3.6 will only allow auth against users in the admin db and will no longer allow multiple credentials on a socket. Please authenticate using MongoClient.connect with auth credentials.
  28. [egg-scripts] 2018-10-12 18:29:11,225 ERROR 7752 [-/127.0.0.1/-/1ms GET /] nodejs.ReplyError: ERR invalid password
  29. [egg-scripts] at JavascriptReplyParser.returnError (D:\project\imqianduan.com\node_modules\ioredis\lib\redis\parser.js:25:25)
  30. [egg-scripts] at JavascriptReplyParser.run (D:\project\imqianduan.com\node_modules\redis-parser\lib\javascript.js:135:18)
  31. [egg-scripts] at JavascriptReplyParser.execute (D:\project\imqianduan.com\node_modules\redis-parser\lib\javascript.js:112:10)
  32. [egg-scripts] at Socket.<anonymous> (D:\project\imqianduan.com\node_modules\ioredis\lib\redis\event_handler.js:107:22)
  33. [egg-scripts] at emitOne (events.js:116:13)
  34. [egg-scripts] at Socket.emit (events.js:211:7)
  35. [egg-scripts] at addChunk (_stream_readable.js:263:12)
  36. [egg-scripts] at readableAddChunk (_stream_readable.js:250:11)
  37. [egg-scripts] at Socket.Readable.push (_stream_readable.js:208:10)
  38. [egg-scripts] at TCP.onread (net.js:607:20)
  39. [egg-scripts] name: "ReplyError"
  40. [egg-scripts] message: "ERR invalid password"
  41. [egg-scripts] command: {"name":"auth","args":["abcd987654321"]}
  42. [egg-scripts] pid: 7752
  43. [egg-scripts] hostname: XNZX-PC-103
  44. [egg-scripts]
  45. [egg-scripts] 2018-10-12 18:29:11,226 ERROR 7752 nodejs.ReplyError: ERR invalid password
  46. [egg-scripts] at JavascriptReplyParser.returnError (D:\project\imqianduan.com\node_modules\ioredis\lib\redis\parser.js:25:25)
  47. [egg-scripts] at JavascriptReplyParser.run (D:\project\imqianduan.com\node_modules\redis-parser\lib\javascript.js:135:18)
  48. [egg-scripts] at JavascriptReplyParser.execute (D:\project\imqianduan.com\node_modules\redis-parser\lib\javascript.js:112:10)
  49. [egg-scripts] at Socket.<anonymous> (D:\project\imqianduan.com\node_modules\ioredis\lib\redis\event_handler.js:107:22)
  50. [egg-scripts] at emitOne (events.js:116:13)
  51. [egg-scripts] at Socket.emit (events.js:211:7)
  52. [egg-scripts] at addChunk (_stream_readable.js:263:12)
  53. [egg-scripts] at readableAddChunk (_stream_readable.js:250:11)
  54. [egg-scripts] at Socket.Readable.push (_stream_readable.js:208:10)
  55. [egg-scripts] at TCP.onread (net.js:607:20)
  56. [egg-scripts] name: "ReplyError"
  57. [egg-scripts] message: "ERR invalid password"
  58. [egg-scripts] command: {"name":"auth","args":["abcd987654321"]}
  59. [egg-scripts] pid: 7752
  60. [egg-scripts] hostname: XNZX-PC-103
  61. [egg-scripts]
  62. [egg-scripts] 2018-10-12 18:29:11,226 ERROR 7752 [app_worker] start error, exiting with code:1
  63. [egg-scripts] 2018-10-12 18:29:11,226 ERROR 7752 [app_worker] exit with code:1
  64. [egg-scripts] 2018-10-12 18:29:11,281 ERROR 11844 nodejs.AppWorkerDiedError: [master] app_worker#4:7752 died (code: 1, signal: null, suicide: false, state: dead), current workers: ["1","2","3"]
  65. [egg-scripts] at Master.onAppExit (D:\project\imqianduan.com\node_modules\egg-cluster\lib\master.js:400:21)
  66. [egg-scripts] at emitOne (events.js:116:13)
  67. [egg-scripts] at Master.emit (events.js:211:7)
  68. [egg-scripts] at Messenger.sendToMaster (D:\project\imqianduan.com\node_modules\egg-cluster\lib\utils\messenger.js:133:17)
  69. [egg-scripts] at Messenger.send (D:\project\imqianduan.com\node_modules\egg-cluster\lib\utils\messenger.js:98:12)
  70. [egg-scripts] at EventEmitter.cluster.on (D:\project\imqianduan.com\node_modules\egg-cluster\lib\master.js:268:22)
  71. [egg-scripts] at emitThree (events.js:141:20)
  72. [egg-scripts] at EventEmitter.emit (events.js:217:7)
  73. [egg-scripts] at ChildProcess.worker.process.once (internal/cluster/master.js:186:13)
  74. [egg-scripts] at Object.onceWrapper (events.js:317:30)
  75. [egg-scripts] name: "AppWorkerDiedError"
  76. [egg-scripts] pid: 11844
  77. [egg-scripts] hostname: XNZX-PC-103
  78. [egg-scripts]
  79. [egg-scripts] 2018-10-12 18:29:11,282 ERROR 11844 [master] app_worker#4:7752 start fail, exiting with code:1
  80. [egg-scripts] 2018-10-12 18:29:11,282 ERROR 11844 [master] exit with code:1
  81. [egg-scripts]
  82. [egg-scripts] Start got error, see C:\Users\88888\logs\master-stderr.log
  83. [egg-scripts] Or use `--ignore-stderr` to ignore stderr at startup.

原因: eggjs启动npm run start时,使用的配置文件是config.default.js,而我本地的redis和线上的redis密码是不一样,config.default.js配置的是线上的redis密码。
换回本地redis密码,问题迎面解决

总结:
这个问题解决的关键是使用了git执行命令,提示了更详情的报错信息,详情的报错信息使用问题变得很清晰

所以window开发,还是建议少用cmd吧,使用git或其他专业的命令行工具,事半功倍

版权声明:本站文章除特别声明外,均采用署名-非商业性使用-禁止演绎 4.0 国际 许可协议,如需转载,请注明出处