9

This is my package.json:

  "scripts": {
    "test": "echo \"Error: no test specified\n\" && exit 1",
    "lint": "npm run lint-js && npm run lint-css",
    "lint-js": "echo \"\\033[33mLinting JS\\033[0m\n\" && eslint . --ext .js --ext .jsx",
    "lint-css": "echo \"\\033[33mLinting CSS\\033[0m\n\" && csslint app/style --quiet",
    "start": "echo \"\\033[33mStarting dev server at localhost:8080\\033[0m\n\" && TARGET=dev webpack-dev-server --devtool eval-source --progress --colors --hot --inline --history-api-fallback",
    "compile": "echo \"\\033[33mBuilding for production\\033[0m\n\" && TARGET=build webpack -p",
    "build": "npm run lint-js && npm run lint-css && npm run compile"
  },
  "private": true,
  "dependencies": {
    "alt": "^0.17.8",
    "babel-core": "^6.1.2",
    "babel-loader": "^6.1.0",
    "babelify": "^7.2.0",
    "css-loader": "^0.22.0",
    "csslint": "^0.10.0",
    "csslint-loader": "^0.2.1",
    "eslint": "^1.9.0",
    "eslint-plugin-react": "^3.8.0",
    "file-loader": "^0.8.4",
    "flowcheck": "^0.2.7",
    "flowcheck-loader": "^1.0.0",
    "gsap": "^1.18.0",
    "html-webpack-plugin": "^1.6.2",
    "jquery-browserify": "^1.8.1",
    "node-libs-browser": "^0.5.3",
    "radium": "^0.14.3",
    "react": "^0.14.2",
    "react-bootstrap": "^0.27.3",
    "react-bootstrap-modal": "^2.0.0",
    "react-dom": "^0.14.2",
    "react-hot-loader": "^1.3.0",
    "react-odometer": "0.0.1",
    "react-slick": "^0.9.1",
    "react-swf": "^0.13.0",
    "style-loader": "^0.13.0",
    "superagent": "^1.4.0",
    "url-loader": "^0.5.6",
    "video.js": "^5.0.2",
    "webpack": "^1.12.3",
    "webpack-dev-server": "^1.12.1",
    "webpack-merge": "^0.2.0"
  }
}

This is the complete error message, I read that this error can be solved using babelify so I added it, although I don't need it.

ERROR in ./app/

main.jsx
Module build failed: ReferenceError: [BABEL] /Dev/Fanatico/node_modules/eslint-loader/index.js!/Dev/Fanatico/app/main.jsx: Unknown option: base.stage
    at Logger.error (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/logger.js:43:11)
    at OptionManager.mergeOptions (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/options/option-manager.js:245:18)
    at OptionManager.init (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/options/option-manager.js:396:10)
    at File.initOptions (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/index.js:191:75)
    at new File (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/index.js:122:22)
    at Pipeline.transform (/Dev/Fanatico/node_modules/babel-core/lib/transformation/pipeline.js:42:16)
    at transpile (/Dev/Fanatico/node_modules/babel-loader/index.js:14:22)
    at Object.module.exports (/Dev/Fanatico/node_modules/babel-loader/index.js:83:14)
 @ multi main

It all started when I wanted to upgrade to React 0.14, and ended up installing all the packages one by one.

user1553825
  • 160
  • 1
  • 1
  • 6

2 Answers2

23

You will need to have installed:

  • babel-core
  • babel-loader
  • babel-preset-es2015
  • babel-preset-react
  • babel-preset-stage-0

Your dependencies in your package.json would be:

{
  "name": "react-transform-example",
  "devDependencies": {
    "babel-core": "^6.0.20",
    "babel-loader": "^6.0.1",
    "babel-preset-es2015": "^6.0.15",
    "babel-preset-react": "^6.0.15",
    "babel-preset-stage-0": "^6.0.15",
    "express": "^4.13.3",
    "webpack": "^1.9.6"
  },
  "dependencies": {
    "react": "^0.14.0",
    "react-dom": "^0.14.0"    
  }
}

And your .babelrc file

{
  "presets": ["es2015", "stage-0", "react"]
}

More info at setting-up-babel-6

svnm
  • 22,878
  • 21
  • 90
  • 105
10

You're using babel 6 which doesn't have a stage option anymore, instead you have to use presets, e.g:

http://babeljs.io/docs/plugins/#presets

http://babeljs.io/docs/plugins/preset-stage-0/

Installation

$ npm install babel-preset-stage-0

Usage

Add the following line to your .babelrc file:

{"presets": ["stage-0"] }

Note you'll also need the es2015 and react preset. Also note that at least some of the hot reloading plugins are not compatible yet.

Dominic
  • 62,658
  • 20
  • 139
  • 163