尝试在 ubuntu 服务器上构建 Next.js 项目时"ReferenceError: TextEncoder is not defined"



我刚刚安装了一个ubuntu服务器,我正试图部署我的next.js项目。在开发环境中,命令npm run build工作正常,但在服务器上,当我运行sudo npm run build时,它返回

> @ build /var/www/paysure_admin
> next build
info  - Checking validity of types  
error - ESLint: Module.createRequire is not a function
info  - Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc.js" https://nextjs.org/docs/messages/swc-disabled
info  - Creating an optimized production build  
info  - Compiled successfully
info  - Collecting page data ./var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9
'use strict';var h=require("react");function n(a,d){a.enqueue(d);return 0<a.desiredSize}var q=new TextEncoder;function r(a,d){"function"===typeof a.error?a.error(d):a.close()}var t=JSON.stringify,u=Symbol.for("react.module.reference"),v=60103,w=60107,x=60112,y=60115,z=60116;if("function"===typeof Symbol&&Symbol.for){var A=Symbol.for;v=A("react.element");w=A("react.fragment");x=A("react.forward_ref");y=A("react.memo");z=A("react.lazy")}var B=Array.isArray,C=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;
                        ^
ReferenceError: TextEncoder is not defined
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9:95)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/writer.browser.server.js:4:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)
/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9
'use strict';var h=require("react");function n(a,d){a.enqueue(d);return 0<a.desiredSize}var q=new TextEncoder;function r(a,d){"function"===typeof a.error?a.error(d):a.close()}var t=JSON.stringify,u=Symbol.for("react.module.reference"),v=60103,w=60107,x=60112,y=60115,z=60116;if("function"===typeof Symbol&&Symbol.for){var A=Symbol.for;v=A("react.element");w=A("react.fragment");x=A("react.forward_ref");y=A("react.memo");z=A("react.lazy")}var B=Array.isArray,C=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;
                        ^
ReferenceError: TextEncoder is not defined
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9:95)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/writer.browser.server.js:4:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)
/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9
'use strict';var h=require("react");function n(a,d){a.enqueue(d);return 0<a.desiredSize}var q=new TextEncoder;function r(a,d){"function"===typeof a.error?a.error(d):a.close()}var t=JSON.stringify,u=Symbol.for("react.module.reference"),v=60103,w=60107,x=60112,y=60115,z=60116;if("function"===typeof Symbol&&Symbol.for){var A=Symbol.for;v=A("react.element");w=A("react.fragment");x=A("react.forward_ref");y=A("react.memo");z=A("react.lazy")}var B=Array.isArray,C=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;
                        ^
ReferenceError: TextEncoder is not defined
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9:95)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/writer.browser.server.js:4:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)
info  - Collecting page data .../var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9
'use strict';var h=require("react");function n(a,d){a.enqueue(d);return 0<a.desiredSize}var q=new TextEncoder;function r(a,d){"function"===typeof a.error?a.error(d):a.close()}var t=JSON.stringify,u=Symbol.for("react.module.reference"),v=60103,w=60107,x=60112,y=60115,z=60116;if("function"===typeof Symbol&&Symbol.for){var A=Symbol.for;v=A("react.element");w=A("react.fragment");x=A("react.forward_ref");y=A("react.memo");z=A("react.lazy")}var B=Array.isArray,C=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;
                        ^
ReferenceError: TextEncoder is not defined
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9:95)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/writer.browser.server.js:4:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)
info  - Collecting page data ./var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9
'use strict';var h=require("react");function n(a,d){a.enqueue(d);return 0<a.desiredSize}var q=new TextEncoder;function r(a,d){"function"===typeof a.error?a.error(d):a.close()}var t=JSON.stringify,u=Symbol.for("react.module.reference"),v=60103,w=60107,x=60112,y=60115,z=60116;if("function"===typeof Symbol&&Symbol.for){var A=Symbol.for;v=A("react.element");w=A("react.fragment");x=A("react.forward_ref");y=A("react.memo");z=A("react.lazy")}var B=Array.isArray,C=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;
                        ^
ReferenceError: TextEncoder is not defined
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9:95)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/writer.browser.server.js:4:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)
/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9
'use strict';var h=require("react");function n(a,d){a.enqueue(d);return 0<a.desiredSize}var q=new TextEncoder;function r(a,d){"function"===typeof a.error?a.error(d):a.close()}var t=JSON.stringify,u=Symbol.for("react.module.reference"),v=60103,w=60107,x=60112,y=60115,z=60116;if("function"===typeof Symbol&&Symbol.for){var A=Symbol.for;v=A("react.element");w=A("react.fragment");x=A("react.forward_ref");y=A("react.memo");z=A("react.lazy")}var B=Array.isArray,C=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;
                        ^
ReferenceError: TextEncoder is not defined
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9:95)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/writer.browser.server.js:4:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)
info  - Collecting page data .../var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9
'use strict';var h=require("react");function n(a,d){a.enqueue(d);return 0<a.desiredSize}var q=new TextEncoder;function r(a,d){"function"===typeof a.error?a.error(d):a.close()}var t=JSON.stringify,u=Symbol.for("react.module.reference"),v=60103,w=60107,x=60112,y=60115,z=60116;if("function"===typeof Symbol&&Symbol.for){var A=Symbol.for;v=A("react.element");w=A("react.fragment");x=A("react.forward_ref");y=A("react.memo");z=A("react.lazy")}var B=Array.isArray,C=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;
                        ^
ReferenceError: TextEncoder is not defined
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9:95)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/writer.browser.server.js:4:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)
info  - Collecting page data ./var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9
'use strict';var h=require("react");function n(a,d){a.enqueue(d);return 0<a.desiredSize}var q=new TextEncoder;function r(a,d){"function"===typeof a.error?a.error(d):a.close()}var t=JSON.stringify,u=Symbol.for("react.module.reference"),v=60103,w=60107,x=60112,y=60115,z=60116;if("function"===typeof Symbol&&Symbol.for){var A=Symbol.for;v=A("react.element");w=A("react.fragment");x=A("react.forward_ref");y=A("react.memo");z=A("react.lazy")}var B=Array.isArray,C=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;
                        ^
ReferenceError: TextEncoder is not defined
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9:95)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/writer.browser.server.js:4:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)
/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9
'use strict';var h=require("react");function n(a,d){a.enqueue(d);return 0<a.desiredSize}var q=new TextEncoder;function r(a,d){"function"===typeof a.error?a.error(d):a.close()}var t=JSON.stringify,u=Symbol.for("react.module.reference"),v=60103,w=60107,x=60112,y=60115,z=60116;if("function"===typeof Symbol&&Symbol.for){var A=Symbol.for;v=A("react.element");w=A("react.fragment");x=A("react.forward_ref");y=A("react.memo");z=A("react.lazy")}var B=Array.isArray,C=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;
                        ^
ReferenceError: TextEncoder is not defined
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9:95)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/writer.browser.server.js:4:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)
info  - Collecting page data .../var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9
'use strict';var h=require("react");function n(a,d){a.enqueue(d);return 0<a.desiredSize}var q=new TextEncoder;function r(a,d){"function"===typeof a.error?a.error(d):a.close()}var t=JSON.stringify,u=Symbol.for("react.module.reference"),v=60103,w=60107,x=60112,y=60115,z=60116;if("function"===typeof Symbol&&Symbol.for){var A=Symbol.for;v=A("react.element");w=A("react.fragment");x=A("react.forward_ref");y=A("react.memo");z=A("react.lazy")}var B=Array.isArray,C=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;
                        ^
ReferenceError: TextEncoder is not defined
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9:95)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/writer.browser.server.js:4:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)
(node:2921) UnhandledPromiseRejectionWarning: Error: Call retries were exceeded
at ChildProcessWorker.initialize (/var/www/paysure_admin/node_modules/next/dist/compiled/jest-worker/index.js:1:12037)
at ChildProcessWorker._onExit (/var/www/paysure_admin/node_modules/next/dist/compiled/jest-worker/index.js:1:12975)
at ChildProcess.emit (events.js:198:13)
at ChildProcess.EventEmitter.emit (domain.js:448:20)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
(node:2921) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 361)
(node:2921) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
info  - Collecting page data ./var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9
'use strict';var h=require("react");function n(a,d){a.enqueue(d);return 0<a.desiredSize}var q=new TextEncoder;function r(a,d){"function"===typeof a.error?a.error(d):a.close()}var t=JSON.stringify,u=Symbol.for("react.module.reference"),v=60103,w=60107,x=60112,y=60115,z=60116;if("function"===typeof Symbol&&Symbol.for){var A=Symbol.for;v=A("react.element");w=A("react.fragment");x=A("react.forward_ref");y=A("react.memo");z=A("react.lazy")}var B=Array.isArray,C=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;
                        ^
ReferenceError: TextEncoder is not defined
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9:95)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/writer.browser.server.js:4:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)
(node:2921) UnhandledPromiseRejectionWarning: Error: Call retries were exceeded
at ChildProcessWorker.initialize (/var/www/paysure_admin/node_modules/next/dist/compiled/jest-worker/index.js:1:12037)
at ChildProcessWorker._onExit (/var/www/paysure_admin/node_modules/next/dist/compiled/jest-worker/index.js:1:12975)
at ChildProcess.emit (events.js:198:13)
at ChildProcess.EventEmitter.emit (domain.js:448:20)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
(node:2921) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 362)
info  - Collecting page data ./var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9
'use strict';var h=require("react");function n(a,d){a.enqueue(d);return 0<a.desiredSize}var q=new TextEncoder;function r(a,d){"function"===typeof a.error?a.error(d):a.close()}var t=JSON.stringify,u=Symbol.for("react.module.reference"),v=60103,w=60107,x=60112,y=60115,z=60116;if("function"===typeof Symbol&&Symbol.for){var A=Symbol.for;v=A("react.element");w=A("react.fragment");x=A("react.forward_ref");y=A("react.memo");z=A("react.lazy")}var B=Array.isArray,C=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;
                        ^
ReferenceError: TextEncoder is not defined
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js:9:95)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/var/www/paysure_admin/node_modules/next/dist/compiled/react-server-dom-webpack/writer.browser.server.js:4:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)
> Build error occurred
{ Error: Call retries were exceeded
at ChildProcessWorker.initialize (/var/www/paysure_admin/node_modules/next/dist/compiled/jest-worker/index.js:1:12037)
at ChildProcessWorker._onExit (/var/www/paysure_admin/node_modules/next/dist/compiled/jest-worker/index.js:1:12975)
at ChildProcess.emit (events.js:198:13)
at ChildProcess.EventEmitter.emit (domain.js:448:20)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12) type: 'WorkerError' }
info  - Collecting page data .npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ build: `next build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ 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!     /root/.npm/_logs/2023-01-21T13_58_11_336Z-debug.log

我使用sudo npm run build,因为我不是服务器的root用户。

<<p>节点版本/strong>= = =比;v16.19.0<<strong> npm版本/strong>= = =比;8.19.3

包。json文件

{
"babelMacros": {
"twin": {
"preset": "emotion"
}
},
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@date-io/moment": "^2.13.1",
"@emotion/css": "^11.5.0",
"@emotion/react": "^11.7.1",
"@emotion/server": "^11.4.0",
"@emotion/styled": "^11.6.0",
"@mui/lab": "^5.0.0-alpha.66",
"@mui/material": "^5.3.0",
"@mui/styles": "^5.3.0",
"@mui/x-data-grid": "^5.3.0",
"@reduxjs/toolkit": "^1.7.2",
"apexcharts": "^3.36.0",
"axios": "^0.25.0",
"downshift": "^6.1.7",
"form-data": "^4.0.0",
"generate-unique-id": "^2.0.1",
"moment": "^2.29.1",
"multer": "^1.4.5-lts.1",
"next": "12.0.9",
"next-connect": "^0.13.0",
"nextjs-progressbar": "^0.0.13",
"nookies": "^2.5.2",
"quill": "^1.3.7",
"react": "^17.0.2",
"react-apexcharts": "^1.4.0",
"react-currency-format": "^1.1.0",
"react-dom": "^17.0.2",
"react-hook-form": "^7.40.0",
"react-otp-input": "^2.4.0",
"react-paystack": "^3.0.5",
"react-quill": "^1.3.5",
"react-redux": "^7.2.6",
"react-to-print": "^2.14.4",
"react-toastify": "^8.2.0",
"swr": "^1.3.0"
},
"devDependencies": {
"@babel/core": "^7.16.0",
"babel-plugin-inline-react-svg": "^2.0.1",
"eslint": "8.15.0",
"eslint-config-next": "12.1.6",
"tailwindcss": "^2.2.19",
"twin.macro": "^2.8.1"
}
}

我已经尝试将我的节点降级到版本14,但仍然没有用

如果你直接在ubuntu上安装node,它会安装版本-10,你需要配置设置然后安装node以获得最新版本v18,我不确定,但这可能是原因,顺便检查一下安装在你的ubuntu实例上的node的版本。

最新更新