mhaagens / react-mobx-react-router4-boilerplate

React, React-Router 4, MobX and Webpack 2-boilerplate with async routes.
560 stars 137 forks source link

Build error: Couldn't find preset "latest" relative to directory #16

Closed hillscottc closed 7 years ago

hillscottc commented 7 years ago

I am not able to build. I hope you fix, because I LOVE everything else about this boilerplate, and plan to use it, if possible.

Install:

git clone xxx
cd react-mobx-react-router4-boilerplate
npm install
npm run build

Error:

ERROR in ./src/index.js
Module build failed: Error: Couldn't find preset "latest" relative to directory "/Users/hills120/dev"
    at /Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-core/lib/transformation/file/options/option-manager.js:298:19
    at Array.map (native)
    at OptionManager.resolvePresets (/Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-core/lib/transformation/file/options/option-manager.js:269:20)
    at OptionManager.mergePresets (/Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-core/lib/transformation/file/options/option-manager.js:258:10)
    at OptionManager.mergeOptions (/Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-core/lib/transformation/file/options/option-manager.js:243:14)
    at OptionManager.init (/Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-core/lib/transformation/file/options/option-manager.js:373:12)
    at File.initOptions (/Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-core/lib/transformation/file/index.js:221:65)
    at new File (/Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-core/lib/transformation/file/index.js:141:24)
    at Pipeline.transform (/Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at transpile (/Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-loader/index.js:38:20)
    at Object.module.exports (/Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-loader/index.js:131:12)
 @ multi babel-polyfill ./src/index
hillscottc commented 7 years ago

Here is the full error. Trying to track down where the exact problem is.

Hash: 4fc8e50c8d049d551ae0
Version: webpack 2.2.0
Time: 7240ms
                                Asset       Size  Chunks                    Chunk Names
   assets/app.4fc8e50c8d049d551ae0.js     149 kB       0  [emitted]         app
assets/vendor.4fc8e50c8d049d551ae0.js     277 kB       1  [emitted]  [big]  vendor
                           index.html  482 bytes          [emitted]         
[./node_modules/babel-polyfill/lib/index.js] ./~/babel-polyfill/lib/index.js 833 bytes {0} [built]
[./node_modules/react-dom/index.js] ./~/react-dom/index.js 63 bytes {1} [built]
[./node_modules/react-router/Link.js] ./~/react-router/Link.js 7.93 kB {1} [built]
[./node_modules/react-router/Match.js] ./~/react-router/Match.js 5.2 kB {1} [built]
[./node_modules/react-router/MemoryRouter.js] ./~/react-router/MemoryRouter.js 2.48 kB {1} [built]
[./node_modules/react-router/Miss.js] ./~/react-router/Miss.js 3.25 kB {1} [built]
[./node_modules/react-router/NavigationPrompt.js] ./~/react-router/NavigationPrompt.js 2.72 kB {1} [built]
[./node_modules/react-router/Redirect.js] ./~/react-router/Redirect.js 2.47 kB {1} [built]
[./node_modules/react-router/ServerRouter.js] ./~/react-router/ServerRouter.js 3.17 kB {1} [built]
[./node_modules/react-router/createServerRenderContext.js] ./~/react-router/createServerRenderContext.js 1.5 kB {1} [built]
   [0] multi babel-polyfill ./src/index 40 bytes {0} [built]
[./node_modules/react-router/index.js] ./~/react-router/index.js 2.85 kB {1} [built]
[./node_modules/react/react.js] ./~/react/react.js 56 bytes {1} [built]
[./src/index.js] ./src/index.js 1.68 kB {0} [built] [failed] [1 error]
   [1] multi react react-dom react-router 52 bytes {1} [built]
    + 528 hidden modules

ERROR in ./src/index.js
Module build failed: Error: Couldn't find preset "latest" relative to directory "/Users/hills120/dev"
    at /Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-core/lib/transformation/file/options/option-manager.js:298:19
    at Array.map (native)
    at OptionManager.resolvePresets (/Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-core/lib/transformation/file/options/option-manager.js:269:20)
    at OptionManager.mergePresets (/Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-core/lib/transformation/file/options/option-manager.js:258:10)
    at OptionManager.mergeOptions (/Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-core/lib/transformation/file/options/option-manager.js:243:14)
    at OptionManager.init (/Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-core/lib/transformation/file/options/option-manager.js:373:12)
    at File.initOptions (/Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-core/lib/transformation/file/index.js:221:65)
    at new File (/Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-core/lib/transformation/file/index.js:141:24)
    at Pipeline.transform (/Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at transpile (/Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-loader/index.js:38:20)
    at Object.module.exports (/Users/hills120/dev/react-mobx-react-router4-boilerplate/node_modules/babel-loader/index.js:131:12)
 @ multi babel-polyfill ./src/index
Child html-webpack-plugin for "index.html":
    [./node_modules/html-webpack-plugin/lib/loader.js!./index.hbs] ./~/html-webpack-plugin/lib/loader.js!./index.hbs 681 bytes {0} [built]
    [./node_modules/lodash/lodash.js] ./~/lodash/lodash.js 535 kB {0} [built]
    [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 509 bytes {0} [built]
    [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 517 bytes {0} [built]
mhaagens commented 7 years ago

Do you have yarn installed globally? Could you try delete the node_modules folder and run yarn instead?

hillscottc commented 7 years ago

Yes, I have done so. Same result

hillscottc commented 7 years ago

Also, I tried upgrading the deps to

"webpack": "^2.2.0",
"webpack-dev-server": "^2.2.0"

the latest release version, rather than the betas. No change.

hillscottc commented 7 years ago

Awesome you here to help for this. I work dev at Disney. I think I have a use for this, if it works. :)

mhaagens commented 7 years ago

I'll have to take a look and get back to you, but could you try to install the boilerplate in a different directory? Do you have a .babelrc file in a parent directory for instance?

hillscottc commented 7 years ago

AHA! That was it! Yes, I had a .babelrc in the parent dir. Don't really need one there. I think. Deleted it...and BINGO. I updated most of the deps, so now I've got:

  "devDependencies": {
    "autoprefixer": "^6.5.0",
    "babel-core": "^6.17.0",
    "babel-loader": "^6.2.5",
    "babel-plugin-transform-async-to-generator": "^6.16.0",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-polyfill": "^6.16.0",
    "babel-preset-es2015": "^6.16.0",
    "babel-preset-react": "^6.22.0",
    "babel-preset-stage-0": "^6.16.0",
    "css-loader": "^0.26.1",
    "extract-text-webpack-plugin": "^2.0.0-beta.4",
    "html-webpack-plugin": "^2.22.0",
    "image-webpack-loader": "^3.2.0",
    "node-sass": "^4.4.0",
    "postcss-loader": "^1.2.2",
    "precss": "^1.4.0",
    "react-hot-loader": "^3.0.0-beta.2",
    "resolve-url-loader": "^1.6.0",
    "rimraf": "^2.5.4",
    "sass-loader": "^4.0.2",
    "style-loader": "^0.13.1",
    "webpack": "^2.2.0",
    "webpack-dev-server": "^2.2.0"
  },
  "dependencies": {
    "axios": "^0.15.0",
    "babel-preset-react": "^6.22.0",
    "faker": "^3.1.0",
    "lazy-route": "^1.0.7",
    "mobx": "^3.0.2",
    "mobx-react": "^4.1.0",
    "mobx-react-devtools": "^4.2.6",
    "moment": "^2.15.1",
    "package": "^1.0.1",
    "react": "^15.3.2",
    "react-dom": "^15.3.2",
    "react-router": "next",
    "webpack-dev-server": "^2.2.0",
    "whatwg-fetch": "^2.0.2"
  },
mhaagens commented 7 years ago

Awesome! So you got it working now? Would love to see the project once it's up :)

hillscottc commented 7 years ago

Yup, It's working for me. I'd like to integrate React into an existing legacy ASP app. I've been searching for the right, light, dev+prod boilerplate with Webpack 2, React, and Mobx.

I'll play around with this over the next couple of days. This looks great. I'll let you know. 👍