【问题标题】:facing an issue while creating a next.js build on ubuntu - webpack error在 ubuntu 上创建 next.js 构建时遇到问题 - webpack 错误
【发布时间】:2021-12-05 05:27:15
【问题描述】:

我正在尝试在 ubuntu LTS 18.0 上构建 next.js 应用程序 使用节点 14.18.0 也尝试使用节点 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.

【问题讨论】:

    标签: node.js linux next.js


    【解决方案1】:

    我最近遇到了node:fs 错误,通过返回到更旧版本的 Node.js 解决了这个问题。不妨试试以下方法:

    nvm install 12.14.1
    nvm use 12.14.1
    

    您可能还想尝试使用不同版本的 NPM。让我知道这是否有帮助!

    【讨论】:

    • 将 12.14.6 更新到 12.14.1
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-02
    相关资源
    最近更新 更多