首页 > 解决方案 > 更新 nuxt.config.js 时开发服务器崩溃

问题描述

我正在使用 nuxt 开发一个新项目,开发服务器运行顺畅,并且每当我更新代码时热重载都可以工作。唯一的问题是nuxt.config.js当我更新文件时,开发服务器崩溃并在终端中出现以下错误。

↻ Updated nuxt.config.js                                                                                                            21:09:59
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: stream.push() after EOF
    at readableAddChunk (_stream_readable.js:240:30)
    at ReaddirpStream.Readable.push (_stream_readable.js:208:10)
    at ReaddirpStream._read (/home/zed/workspace/fire_app/fire_app/fire_app/frontend/node_modules/readdirp/index.js:140:22)
    at <anonymous>

npm ERR! Linux 4.15.0-74-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! fireapp_frontend@1.0.0 dev: `nuxt`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the fireapp_frontend@1.0.0 dev script 'nuxt'.
npm ERR! Make sure you have the latest version of node.js and npm installed.

这是npm-debug.log文件

1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'dev' ]
2 info using npm@3.5.2
3 info using node@v8.10.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle fireapp_frontend@1.0.0~predev: fireapp_frontend@1.0.0
6 silly lifecycle fireapp_frontend@1.0.0~predev: no script for predev, continuing
7 info lifecycle fireapp_frontend@1.0.0~dev: fireapp_frontend@1.0.0
8 verbose lifecycle fireapp_frontend@1.0.0~dev: unsafe-perm in lifecycle true
9 verbose lifecycle fireapp_frontend@1.0.0~dev: PATH: /usr/share/npm/bin/node-gyp-bin:/home/zed/workspace/fire_app/fire_app/frontend/node_modules/.bin:/home/zed/Qt5.13.0/5.13.0/gcc_64/bin/:/home/zed/go/bin:/usr/local/go/bin:/home/zed/Qt5.13.0/5.13.0/gcc_64/bin/:/home/zed/go/bin:/usr/local/go/bin:/home/zed/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/zed/go/bin:/home/zed/go/bin
10 verbose lifecycle fireapp_frontend@1.0.0~dev: CWD: /home/zed/workspace/fire_app/fire_app/frontend
11 silly lifecycle fireapp_frontend@1.0.0~dev: Args: [ '-c', 'nuxt' ]
12 silly lifecycle fireapp_frontend@1.0.0~dev: Returned: code: 1  signal: null
13 info lifecycle fireapp_frontend@1.0.0~dev: Failed to exec dev script
14 verbose stack Error: fireapp_frontend@1.0.0 dev: `nuxt`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/usr/share/npm/lib/utils/lifecycle.js:232:16)
14 verbose stack     at emitTwo (events.js:126:13)
14 verbose stack     at EventEmitter.emit (events.js:214:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/share/npm/lib/utils/spawn.js:24:14)
14 verbose stack     at emitTwo (events.js:126:13)
14 verbose stack     at ChildProcess.emit (events.js:214:7)
14 verbose stack     at maybeClose (internal/child_process.js:925:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
15 verbose pkgid fireapp_frontend@1.0.0
16 verbose cwd /home/zed/workspace/fire_app/fire_app/frontend
17 error Linux 4.15.0-74-generic
18 error argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
19 error node v8.10.0
20 error npm  v3.5.2
21 error code ELIFECYCLE
22 error fireapp_frontend@1.0.0 dev: `nuxt`
22 error Exit status 1
23 error Failed at the fireapp_frontend@1.0.0 dev script 'nuxt'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the fireapp_frontend package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     nuxt
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs fireapp_frontend
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls fireapp_frontend
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

环境:平台:Ubuntu 18.04

Npm 版本:3.5.2

节点:v8.10.0

"nuxt": "^2.0.0",

标签: node.jsnpmnuxt.js

解决方案


正如 Paul 在上面的评论中建议的那样,我更新了 NPM 和 Node,问题得到了解决,我按照这里的步骤操作

将 Node 和 NPM 更新为6.13.4并将 Node 更新为v12.14.1


推荐阅读