Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module build failed: Error: Couldn't find preset "es2015" relative to directory ".../nextgram/pages" #643

Closed
gmondragon opened this issue Jan 3, 2017 · 8 comments

Comments

@gmondragon
Copy link

Hi. I installed Next.js for the first time to test and when I run "npm run dev" it gives me the following error:

Module build failed: Error: Couldn't find preset "es2015" relative to directory "/Users/gabriel/Developing/nextgram/pages" at /Users/gabriel/Developing/nextgram/node_modules/next/node_modules/babel-core/lib/transformation/file/options/option-manager.js:299:19 at Array.map (native) at OptionManager.resolvePresets (/Users/gabriel/Developing/nextgram/node_modules/next/node_modules/babel-core/lib/transformation/file/options/option-manager.js:270:20) at OptionManager.mergePresets (/Users/gabriel/Developing/nextgram/node_modules/next/node_modules/babel-core/lib/transformation/file/options/option-manager.js:259:10) at OptionManager.mergeOptions (/Users/gabriel/Developing/nextgram/node_modules/next/node_modules/babel-core/lib/transformation/file/options/option-manager.js:244:14) at OptionManager.init (/Users/gabriel/Developing/nextgram/node_modules/next/node_modules/babel-core/lib/transformation/file/options/option-manager.js:374:12) at File.initOptions (/Users/gabriel/Developing/nextgram/node_modules/next/node_modules/babel-core/lib/transformation/file/index.js:216:65) at new File (/Users/gabriel/Developing/nextgram/node_modules/next/node_modules/babel-core/lib/transformation/file/index.js:139:24) at Pipeline.transform (/Users/gabriel/Developing/nextgram/node_modules/next/node_modules/babel-core/lib/transformation/pipeline.js:46:16) at transpile (/Users/gabriel/Developing/nextgram/node_modules/next/node_modules/babel-loader/lib/index.js:41:20)

I tried the example application "nextgram" and it turns out to give the same error.

Regards.

@victorkane
Copy link

I still have this problem. What am I doing wrong?

@gmondragon
Copy link
Author

@victorkane I solved it by updating Nodejs to its latest version. Requires Nodejs v5 up as far as I can tell.

@victorkane
Copy link

victorkane commented Jan 4, 2017

On my Mac, I updated to Node 6.9.3 LTS and:

  • installed 6.9.3 LTS
  • new terminal
  • deleted node_modules
  • Then did npm install again and everything fine!!! Thanks!

Free to close issue

@hegelstad
Copy link

I still have this problem, none of the above tricks did it.
Node v6.10.2
NPM v3.10.10
Next ^2.1.0

Error in /Users/nikolai/github/nextapp/pages/index.js?entry Module build failed: Error: Couldn't find preset "es2015" relative to directory "/Users/nikolai" at /Users/nikolai/github/nextapp/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19 at Array.map (native) at OptionManager.resolvePresets (/Users/nikolai/github/nextapp/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20) at OptionManager.mergePresets (/Users/nikolai/github/nextapp/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10) at OptionManager.mergeOptions (/Users/nikolai/github/nextapp/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14) at OptionManager.init (/Users/nikolai/github/nextapp/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12) at File.initOptions (/Users/nikolai/github/nextapp/node_modules/babel-core/lib/transformation/file/index.js:212:65) at new File (/Users/nikolai/github/nextapp/node_modules/babel-core/lib/transformation/file/index.js:135:24) at Pipeline.transform (/Users/nikolai/github/nextapp/node_modules/babel-core/lib/transformation/pipeline.js:46:16) at transpile (/Users/nikolai/github/nextapp/node_modules/babel-loader/lib/index.js:46:20)

@hegelstad
Copy link

Fix: Removed (hidden) .babelrc (global?) file from "/Users/nikolai".

@Ihor912
Copy link

Ihor912 commented Jun 16, 2017

I want to confirm that solution from previous comment works for me. I tried different fixes but issue didn't disappear. But this one resolved problem. Thanks hegelstad.

Fix: Removed (hidden) .babelrc (global?) file from "/Users/nikolai".

@sea-witch
Copy link

I had the same problem as @hegelstad and @Ihor912, and removing a .babelrc up the tree fixed it for me as well. This seems to be a somewhat common issue. Maybe it would be good to put this in the automated tutorial? I can imagine this issue completely flummoxing folks who are new to babel and/or the command line.

@ghost
Copy link

ghost commented Feb 10, 2018

I had the same issue...
when you run $ npm run dev, it says running .babelrc from folderXYZ
... from the folder you last ran babel or react!
=> Delete that file! Solved! Thank you

@lock lock bot locked as resolved and limited conversation to collaborators Feb 10, 2019
ijjk pushed a commit to ijjk/next.js that referenced this issue Apr 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants