Reactjs &引用;removeHeader不是一个函数;重新启动NextJS项目Ubuntu时出错
我在Next.js项目中遇到了问题。我在live server上运行该项目,完成所有工作。在第一个runnig by commandReactjs &引用;removeHeader不是一个函数;重新启动NextJS项目Ubuntu时出错,reactjs,ubuntu,next.js,Reactjs,Ubuntu,Next.js,我在Next.js项目中遇到了问题。我在live server上运行该项目,完成所有工作。在第一个runnig by commandnpm run start中,所有操作都正确,但如果重新启动服务器,则会出现下一个错误: TypeError: a.removeHeader is not a function at SendStream.removeContentHeaderFields (/home/dzi/website/node_modules/next/dist/compiled/
npm run start
中,所有操作都正确,但如果重新启动服务器,则会出现下一个错误:
TypeError: a.removeHeader is not a function
at SendStream.removeContentHeaderFields (/home/dzi/website/node_modules/next/dist/compiled/send/index.js:1:5160)
at SendStream.notModified (/home/dzi/website/node_modules/next/dist/compiled/send/index.js:1:5273)
at SendStream.send (/home/dzi/website/node_modules/next/dist/compiled/send/index.js:1:7976)
at onstat (/home/dzi/website/node_modules/next/dist/compiled/send/index.js:1:8914)
at FSReqCallback.oncomplete (fs.js:184:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nexjs-format-app@0.0.1 start: `next start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nexjs-format-app@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
如果我用pm2运行项目,我也会有同样的错误。pm2的日志文件:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/usr/bin/node',
1 verbose cli '/usr/lib/node_modules/pm2/lib/ProcessContainerFork.js',
1 verbose cli 'start'
1 verbose cli ]
2 info using npm@6.14.8
3 info using node@v14.15.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle nexjs-format-app@0.0.1~prestart: nexjs-format-app@0.0.1
6 info lifecycle nexjs-format-app@0.0.1~start: nexjs-format-app@0.0.1
7 verbose lifecycle nexjs-format-app@0.0.1~start: unsafe-perm in lifecycle true
8 verbose lifecycle nexjs-format-app@0.0.1~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/dzi/website/node_modules/.bin:/usr/local>
9 verbose lifecycle nexjs-format-app@0.0.1~start: CWD: /home/dzi/website
10 silly lifecycle nexjs-format-app@0.0.1~start: Args: [ '-c', 'next start' ]
11 silly lifecycle nexjs-format-app@0.0.1~start: Returned: code: 1 signal: null
12 info lifecycle nexjs-format-app@0.0.1~start: Failed to exec start script
13 verbose stack Error: nexjs-format-app@0.0.1 start: `next start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1048:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid nexjs-format-app@0.0.1
15 verbose cwd /home/dzi/website
16 verbose Linux 5.4.0-26-generic
17 verbose argv "/usr/bin/node" "/usr/lib/node_modules/pm2/lib/ProcessContainerFork.js" "start"
18 verbose node v14.15.1
19 verbose npm v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error nexjs-format-app@0.0.1 start: `next start`
22 error Exit status 1
23 error Failed at the nexjs-format-app@0.0.1 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
服务器:Ubuntu 20.04 x64,1核,1GB内存嘿!你能解决吗?嘿!你能解决它吗?
[package.json]
{
"name": "nexjs-format-app",
"version": "0.0.1",
"description": "Online market",
"main": "_app.js",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"keywords": [
"market",
"format"
],
"author": "Dz",
"license": "ISC",
"dependencies": {
"bootstrap": "^4.5.3",
"firebase": "^8.0.1",
"next": "^10.0.1",
"react": "^17.0.1",
"react-bootstrap": "^1.4.0",
"react-dom": "^17.0.1",
"react-icons": "^3.11.0",
"react-redux": "^7.2.2",
"redux": "^4.0.5"
}
}
[next.config.js]
module.exports = {
trailingSlash: true,
distDir: 'build'
}