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

Created on 27 Jan 2017  路  8Comments  路  Source: vercel/next.js

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.

Most helpful comment

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"]
}

All 8 comments

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

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

I'll check this 馃憤

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

sure

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)

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"]
}

Good catch @arunoda 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

sospedra picture sospedra  路  3Comments

renatorib picture renatorib  路  3Comments

YarivGilad picture YarivGilad  路  3Comments

olifante picture olifante  路  3Comments