每次尝试运行'npm run build'时都会出错

时间:2019-11-19 07:50:15

标签: reactjs npm ssh next.js

我正在使用React和Next.js创建一个网站。我已经将所有文件放在主机上。我已经通过SSH连接到它。当我尝试运行命令'npm run build'时失败。

这是我遇到的错误:

Creating an optimized production build ...node: ../deps/uv/src/unix/core.c:556: uv__close_nocheckstdio: Assertion `fd > -1' failed.
Aborted
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! MyProject@1.0.0 build: `next build`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the MyProject@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/u502932/.npm/_logs/2019-11-19T07_42_16_088Z-debug.log

这是调试日志:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/home/u502932/.nvm/versions/node/v13.1.0/bin/node',
1 verbose cli   '/home/u502932/.nvm/versions/node/v13.1.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'build'
1 verbose cli ]
2 info using npm@6.12.1
3 info using node@v13.1.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle MyProject@1.0.0~prebuild: MyProject@1.0.0
6 info lifecycle MyProject@1.0.0~build: MyProject@1.0.0
7 verbose lifecycle MyProject@1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle MyProject@1.0.0~build: PATH: /home/u502932/.nvm/versions/node/v13.1.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/u502932/react.viimiracula.ru/www/node_modules/.bin:/home/u502932/.nvm/versions/node/v13.1.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
9 verbose lifecycle MyProject@1.0.0~build: CWD: /home/u502932/react.viimiracula.ru/www
10 silly lifecycle MyProject@1.0.0~build: Args: [ '-c', 'next build' ]
11 silly lifecycle MyProject@1.0.0~build: Returned: code: 134  signal: null
12 info lifecycle MyProject@1.0.0~build: Failed to exec build script
13 verbose stack Error: MyProject@1.0.0 build: `next build`
13 verbose stack Exit status 134
13 verbose stack     at EventEmitter.<anonymous> (/home/u502932/.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/u502932/.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)
14 verbose pkgid MyProject@1.0.0
15 verbose cwd /home/u502932/react.viimiracula.ru/www
16 verbose Linux 4.19.0-0.bpo.6-amd64
17 verbose argv "/home/u502932/.nvm/versions/node/v13.1.0/bin/node" "/home/u502932/.nvm/versions/node/v13.1.0/bin/npm" "run" "build"
18 verbose node v13.1.0
19 verbose npm  v6.12.1
20 error code ELIFECYCLE
21 error errno 134
22 error MyProject@1.0.0 build: `next build`
22 error Exit status 134
23 error Failed at the MyProject@1.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 134, true ]

我只是不知道该怎么办。请帮忙。

1 个答案:

答案 0 :(得分:0)

我认为您必须安装webpack,然后重试以构建项目 npm install --save-dev webpack