next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Module build failed: Error: Couldn't find preset "react-server" relative to directory

Open kishanj918 opened this issue 9 years ago • 8 comments

Node version : 7.0.0 npm version: 3.10.8 I am getting "Module build failed: Error: Couldn't find preset "react-server" relative to directory" error while running npm run dev.

kishanj918 avatar Jan 27 '17 09:01 kishanj918

Hi, could you please provide an example repository / steps to reproduce?

timneutkens avatar Jan 27 '17 10:01 timneutkens

I was getting this error while running this https://github.com/zeit/nextgram app.

kishanj918 avatar Jan 27 '17 11:01 kishanj918

I'll check this 👍

timneutkens avatar Jan 27 '17 11:01 timneutkens

Can't reproduce. Can you try to run npm install in the directory?

timneutkens avatar Jan 27 '17 11:01 timneutkens

sure

kishanj918 avatar Jan 27 '17 11:01 kishanj918

still getting the same error.

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

kishanj918 avatar Jan 27 '17 11:01 kishanj918

I think that's because of some .babelrc file in somewhere in a parent directory. @kishanj918 add following .babelrc file into the app root.

{
  "presets": ["next/babel"]
}

arunoda avatar Jan 27 '17 12:01 arunoda

Good catch @arunoda 👍

timneutkens avatar Jan 27 '17 12:01 timneutkens