question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

All examples failing to build with `Error: Cannot find module './dist/server/build/babel/preset'`

See original GitHub issue

Examples 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:closed
  • Created 5 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
timneutkenscommented, May 24, 2018

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

2reactions
timneutkenscommented, May 24, 2018
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found