Set the node_modules as symlink in 9.5.2, the build process fails
See original GitHub issueBug report
Describe the bug
Set the node_modules as symlink, in v9.5.2, the build process fail while v9.4.4 is success.
The error messages:
yarn run v1.22.4
$ next build
info - Creating an optimized production build
info - Compiled successfully
info - Collecting page data
[= ] info - Generating static pages (0/2)
Error occurred prerendering page "/404". Read more: https://err.sh/next.js/prerender-error
Error: Minified React error #321; visit https://reactjs.org/docs/error-decoder.html?invariant=321 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at Z (/Users/Hank.Lin/playground/next-app/.next/server/pages/_document.js:177:404)
at module.exports.BdB7.exports.useContext (/Users/Hank.Lin/playground/next-app/.next/server/pages/_document.js:182:261)
at Html (/Users/Hank.Lin/playground/next-app/.next/server/pages/_document.js:773:29)
at d (/Users/Hank.Lin/playground/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:498)
at $a (/Users/Hank.Lin/playground/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:39:16)
at a.b.render (/Users/Hank.Lin/playground/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:476)
at a.b.read (/Users/Hank.Lin/playground/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:18)
at renderToStaticMarkup (/Users/Hank.Lin/playground/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:54:462)
at renderDocument (/Users/Hank.Lin/playground/node_modules/next/dist/next-server/server/render.js:3:624)
at renderToHTML (/Users/Hank.Lin/playground/node_modules/next/dist/next-server/server/render.js:50:72)
Error occurred prerendering page "/". Read more: https://err.sh/next.js/prerender-error
Error: Minified React error #321; visit https://reactjs.org/docs/error-decoder.html?invariant=321 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at Z (/Users/Hank.Lin/playground/next-app/.next/server/pages/_document.js:177:404)
at module.exports.BdB7.exports.useContext (/Users/Hank.Lin/playground/next-app/.next/server/pages/_document.js:182:261)
at Html (/Users/Hank.Lin/playground/next-app/.next/server/pages/_document.js:773:29)
at d (/Users/Hank.Lin/playground/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:498)
at $a (/Users/Hank.Lin/playground/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:39:16)
at a.b.render (/Users/Hank.Lin/playground/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:476)
at a.b.read (/Users/Hank.Lin/playground/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:18)
at renderToStaticMarkup (/Users/Hank.Lin/playground/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:54:462)
at renderDocument (/Users/Hank.Lin/playground/node_modules/next/dist/next-server/server/render.js:3:624)
at renderToHTML (/Users/Hank.Lin/playground/node_modules/next/dist/next-server/server/render.js:50:72)
info - Generating static pages (2/2)
> Build error occurred
Error: Export encountered errors on following paths:
/
/404
at exportApp (/Users/Hank.Lin/playground/node_modules/next/dist/export/index.js:24:1103)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async build (/Users/Hank.Lin/playground/node_modules/next/dist/build/index.js:37:212)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
To Reproduce
yarn create next-app
rm -rf node_modules
&ln -s some_path/node_modules
yarn
&yarn build
System information
- OS: mac os
- Version of Next.js: 9.5.2
- Version of Node.js: 12.16.1
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
npm install fails when node_modules is a symlink #10013
The reason for relying on a symlinked node_modules is that I sync my development folder over multiple machines, but symlink all huge folders, ......
Read more >Having project_name/node_modules as a symlink?
Still looking into it, but this does seem to be working for me. The steps to try it would be 1) remove node_modules...
Read more >The magic behind npm link - Medium
Node.js has a very simple module loading strategy. ... npm creates a symbolic link from your “global node_modules” directory to the local module's...
Read more >EasyBuild v4.6.2 documentation (release 20221021.0)
The latest version of EasyBuild provides support for building and installing 2,798 different software packages, including 37 different (compiler) toolchains ...
Read more >npm-link
First, npm link in a package folder with no arguments will create a symlink in the global folder {prefix}/lib/node_modules/<package> that links to the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Investigation update:
When set the node_modules as symlink, and the run
yarn build
, the.next/server/pages/_document.js
contained thereact.producion.min.js
Refer to https://github.com/facebook/react/issues/16029#issuecomment-570912067 Set the webpack config in
next.confg.js
The build process is success.
The next.js version is
9.5.4-canary.5
Same here, but the error is different.
For the production build is success, but when starting the service i got this error.