Closed
Description
📦 Deployment Method
Other
📌 Version
2.16.0
💻 Operating System
Ubuntu
📌 System Version
22.04
🌐 Browser
Other
📌 Browser Version
None
🐛 Bug Description
问题背景
进入src-tauri目录后使用 cargo tauri build后报错
前置操作
由于无法构建,参考了 #6154 解决了Server Actions are not supported with static export问题
后续出现如下问题
详细报错
sxq@sxq:~/NextChat/src-tauri$ cargo tauri build
Running beforeBuildCommand `yarn export`
yarn run v1.22.19
$ yarn mask && cross-env BUILD_MODE=export BUILD_APP=1 next build
$ npx tsx app/masks/build.ts
⨯ Failed to load next.config.mjs, see more info here https://nextjs.org/docs/messages/next-config-error
> Build error occurred
SyntaxError: Invalid regular expression: missing /
at compileSourceTextModule (node:internal/modules/esm/utils:344:16)
at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:105:18)
at #translate (node:internal/modules/esm/loader:534:12)
at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:581:27)
at async ModuleJob._link (node:internal/modules/esm/module_job:116:19)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error beforeBuildCommand `yarn export` failed with exit code 1
sxq@sxq:~/NextChat/src-tauri$ cargo tauri build
Running beforeBuildCommand `yarn export`
yarn run v1.22.19
$ yarn mask && cross-env BUILD_MODE=export BUILD_APP=1 next build
$ npx tsx app/masks/build.ts
[Next] build mode export
[Next] build with chunk: false
▲ Next.js 14.1.1
- Experiments (use at your own risk):
· forceSwcTransforms
Creating an optimized production build ...
⚠ For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'npm i sharp', and Next.js will use it automatically for Image Optimization.
Read more: https://nextjs.org/docs/messages/sharp-missing-in-production
<w> [webpack.cache.PackFileCacheStrategy] Skipped not serializable cache item 'Compilation/modules|javascript/auto|/home/sxq/NextChat/node_modules/next/dist/build/webpack/loaders/next-flight-css-loader.js??ruleSet[1].rules[12].oneOf[9].use[0]!/home/sxq/NextChat/node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[12].oneOf[9].use[1]!/home/sxq/NextChat/node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[12].oneOf[9].use[2]!/home/sxq/NextChat/node_modules/next/dist/build/webpack/loaders/resolve-url-loader/index.js??ruleSet[1].rules[12].oneOf[9].use[3]!/home/sxq/NextChat/node_modules/next/dist/compiled/sass-loader/cjs.js??ruleSet[1].rules[12].oneOf[9].use[4]!/home/sxq/NextChat/app/components/chat.module.scss|ssr': No serializer registered for Warning
<w> while serializing webpack/lib/cache/PackFileCacheStrategy.PackContentItems -> webpack/lib/NormalModule -> Array { 1 items } -> webpack/lib/ModuleWarning -> Warning
<w> [webpack.cache.PackFileCacheStrategy] Skipped not serializable cache item 'Compilation/modules|/home/sxq/NextChat/node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[11].oneOf[9].use[2]!/home/sxq/NextChat/node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[11].oneOf[9].use[3]!/home/sxq/NextChat/node_modules/next/dist/build/webpack/loaders/resolve-url-loader/index.js??ruleSet[1].rules[11].oneOf[9].use[4]!/home/sxq/NextChat/node_modules/next/dist/compiled/sass-loader/cjs.js??ruleSet[1].rules[11].oneOf[9].use[5]!/home/sxq/NextChat/app/components/chat.module.scss': No serializer registered for Warning
<w> while serializing webpack/lib/cache/PackFileCacheStrategy.PackContentItems -> webpack/lib/NormalModule -> Array { 1 items } -> webpack/lib/ModuleWarning -> Warning
Failed to compile.
node:child_process
Module build failed: UnhandledSchemeError: Reading from "node:child_process" 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.
at /home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:399825
at Hook.eval [as callAsync] (eval at create (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:13:28867), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:13:26021)
at Object.processResource (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:399750)
at processResource (/home/sxq/NextChat/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308)
at iteratePitchingLoaders (/home/sxq/NextChat/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667)
at runLoaders (/home/sxq/NextChat/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590)
at NormalModule._doBuild (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:399612)
at NormalModule.build (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:401640)
at /home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:82059
at NormalModule.needBuild (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:405716)
at Compilation._buildModule (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:81776)
at /home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:1324496
at Hook.eval [as callAsync] (eval at create (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:13:28867), <anonymous>:6:1)
at AsyncQueue._startProcessing (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:1324367)
at AsyncQueue._ensureProcessing (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:1324216)
at process.processImmediate (node:internal/timers:485:21)
Import trace for requested module:
node:child_process
./node_modules/@modelcontextprotocol/sdk/dist/client/stdio.js
./app/mcp/client.ts
./app/mcp/actions.ts
./app/components/home.tsx
node:process
Module build failed: UnhandledSchemeError: Reading from "node:process" 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.
at /home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:399825
at Hook.eval [as callAsync] (eval at create (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:13:28867), <anonymous>:6:1)
at Object.processResource (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:399750)
at processResource (/home/sxq/NextChat/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308)
at iteratePitchingLoaders (/home/sxq/NextChat/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667)
at runLoaders (/home/sxq/NextChat/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590)
at NormalModule._doBuild (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:399612)
at NormalModule.build (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:401640)
at /home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:82059
at NormalModule.needBuild (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:405716)
at Compilation._buildModule (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:81776)
at /home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:1324496
at Hook.eval [as callAsync] (eval at create (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:13:28867), <anonymous>:6:1)
at AsyncQueue._startProcessing (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:1324367)
at AsyncQueue._ensureProcessing (/home/sxq/NextChat/node_modules/next/dist/compiled/webpack/bundle5.js:28:1324216)
at process.processImmediate (node:internal/timers:485:21)
Import trace for requested module:
node:process
./node_modules/@modelcontextprotocol/sdk/dist/client/stdio.js
./app/mcp/client.ts
./app/mcp/actions.ts
./app/components/home.tsx
> Build failed because of webpack errors
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error beforeBuildCommand `yarn export` failed with exit code 1
📷 Recurrence Steps
No response
🚦 Expected Behavior
No response
📝 Additional Information
No response