简体   繁体   English

在 ubuntu 上创建 next.js 构建时遇到问题 - webpack 错误

[英]facing an issue while creating a next.js build on ubuntu - webpack error

I am trying to build next.js app on ubuntu LTS 18.0 with node 14.18.0 also tried with node 16 but no luck!我正在尝试使用节点 14.18.0 在 ubuntu LTS 18.0 上构建 next.js 应用程序,也尝试使用节点 16,但没有运气!

yarn run v1.22.15
$ next build
info  - Loaded env from /home/name/heb/HEB-IOT-UI/.env
info  - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
info  - Checking validity of types  
warn  - No ESLint configuration detected. Run next lint to begin setup
info  - Creating an optimized production build  
Failed to compile.

node:fs
Module build failed: UnhandledSchemeError: Reading from "node:fs" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.


> Build error occurred
Error: > Build failed because of webpack errors
    at /home/name/heb/HEB-IOT-UI/node_modules/next/dist/build/index.js:397:19
    at async Span.traceAsyncFn (/home/name/heb/HEB-IOT-UI/node_modules/next/dist/telemetry/trace/trace.js:60:20)
    at async Object.build [as default] (/home/name/heb/HEB-IOT-UI/node_modules/next/dist/build/index.js:77:25)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I have encountered a node:fs error recently, which was resolved by going back to an even older version of Node.我最近遇到了一个node:fs错误,通过回到更旧版本的 Node.js 解决了这个问题。 Perhaps try the following:也许尝试以下方法:

nvm install 12.14.1
nvm use 12.14.1

You may also want to try using a different version of NPM.您可能还想尝试使用不同版本的 NPM。 Let me know if that helps!让我知道这是否有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM