All examples failing to build with `Error: Cannot find module './dist/server/build/babel/preset'`
See original GitHub issueExamples bug report
Example name
with-react-helmet
, using-router
, basic-css
etc
Describe the bug
Fails to build with bable error:
{ Error: Cannot find module './dist/server/build/babel/preset'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:571:15)
at Function.Module._load (internal/modules/cjs/loader.js:497:25)
at Module.require (internal/modules/cjs/loader.js:626:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/Users/a_user/dev/nextbug/next.js/babel.js:1:80)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
at Module.require (internal/modules/cjs/loader.js:626:17)
at require (internal/modules/cjs/helpers.js:20:18)
at requireModule (/Users/a_user/dev/nextbug/next.js/examples/with-react-helmet/node_modules/@babel/core/lib/config/files/plugins.js:142:12)
at loadPreset (/Users/a_user/dev/nextbug/next.js/examples/with-react-helmet/node_modules/@babel/core/lib/config/files/plugins.js:56:15)
at createDescriptor (/Users/a_user/dev/nextbug/next.js/examples/with-react-helmet/node_modules/@babel/core/lib/config/config-descriptors.js:152:21)
at /Users/a_user/dev/nextbug/next.js/examples/with-react-helmet/node_modules/@babel/core/lib/config/config-descriptors.js:104:12 code: 'MODULE_NOT_FOUND' }
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
git clone git@github.com:zeit/next.js.git && cd ./next.js/examples/basic-css && yarn install && yarn run build
Expected behavior
Should build without error
System information
- OS:
osx
- Version of Next.js:
6.0.3
Additional context
I think it’s something to do with babel dependencies Probably related to #4467
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Examples bug report - GitHub
Describe the bug. Fails to build with bable error: { Error: Cannot find module './dist/server/build/babel/preset' at Function.Module.
Read more >How do I resolve "Cannot find module" error using Node.js?
Using npm install installs the module into the current directory only (in a subdirectory called node_modules ). Is app.js located under ...
Read more >cannot find module [Node npm Error Solved] - freeCodeCamp
I'll do that by running yarn add react-icons . Once I install the package and run the app, everything should successfully compile: ss2....
Read more >Failed Login with error "Cannot find module..."
We are observing the “Cannot find module” error when using an Action, Rule, or Hook. Symptoms. Logins will fail with the error beginning...
Read more >How do I build a Lambda deployment package for Node.js?
I created an AWS Lambda function in Node.js, but I get a "Cannot find module" error during invocation. How do I build my...
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
If you
git clone
you have to build Next.js (yarn build
in the main directory) first before executing any of the examples, since the built babel preset is used. This is why none of the instructions for the examples mention cloning the repository 👍 Also cloning the repository for 1 out of 100+ examples takes a lot of time usually, that’s why we favor downloading /npx init
/yarn create
This is the babelrc: https://github.com/zeit/next.js/blob/canary/examples/.babelrc