Module build failed: Error: Couldn’t find preset “stage-0” relative to directory

I encountered a really strange issue:

when I start my webpack-dev-server with a jasmine-es6 module installed, webpack bundles successfully, however, if I remove that module from package.json, I have the error stated in the title.

Here’s my package JSON:

{
  "name": "minimal-react-starter",
  "version": "0.0.1",
  "description": "React Gallery",
  "main": "js/index.js",
  "scripts": {
    "start": "webpack-dev-server --content-base=www --hot --inline --watch --config=webpack.config.js"
  },
  "author": "Roland Yegorov",
  "license": "",
  "repository": {
    "type": "git",
    "url": ""
  },
  "dependencies": {
    "babel-runtime": "^6.9.2",
    "react": "^15.2.0",
    "react-addons-shallow-compare": "^15.2.1",
    "react-dom": "^15.2.0"
  },
  "devDependencies": {
    "babel-cli": "^6.10.1",
    "babel-core": "^6.10.4",
    "babel-loader": "^6.2.4",
    "babel-plugin-transform-runtime": "^6.9.0",
    "babel-polyfill": "^6.9.1",
    "babel-preset-es2015": "^6.9.0",
    "babel-preset-react": "^6.11.1",
    "babel-register": "^6.9.0",
    "css-loader": "^0.23.1",

    "jasmine-es6": "^0.1.10",  <--- removing this fails the bundler

    "node-sass": "^3.8.0",
    "sass-loader": "^4.0.0",
    "style-loader": "^0.13.1",
    "webpack": "^1.12.2",
    "webpack-dev-server": "^1.12.1"
  }
}

So I wonder if there is something being installed along the jasmine-es6 module that other packages are NOW missing?

Any ideas? Cause this has already taken a few hours to find…

Author: Fantashit

5 thoughts on “Module build failed: Error: Couldn’t find preset “stage-0” relative to directory

  1. @astericky Sorry for the late reply, but the fix was simply adding babel-preset-stage-0 to your package.json and adding it to webpack loaders.

        module: {
            loaders: [
                {
                    test: /\.jsx?$/,
                    exclude: /node_modules/,
                    loader: 'babel-loader',
                    query: {
                        plugins: ['transform-runtime'],
                        presets: ['es2015', 'react', 'stage-0'] // <--- here
                    }
                }, {
                    test: /\.[s]?css$/,
                    loader: 'style!css!sass'
                }
            ]
        },
    
  2. If you’re here and you still have no clue…

    yarn add babel-preset-stage-0

    or

    npm install babel-preset-stage-0

    and refer to comment number 5.

Comments are closed.