KleoPetroff/react-webpack-boilerplate

Cannot find module '@babel/core'

robsonmrsp opened this issue · 2 comments

After update to the last version I get this error at npm start:

ERROR in ./main.js
Module build failed (from ../node_modules/babel-loader/lib/index.js):
Error: Cannot find module '@babel/core'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
at Function.Module._load (internal/modules/cjs/loader.js:520:25)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)

my envs:
Macbook
react-webpack-boilerplate git:(master) ✗ npm --version
6.1.0
react-webpack-boilerplate git:(master) ✗ node --version
v10.5.0

ps: The same error where gotten on windows 10 and linux mint 19, with the last versions of npm and node

run npm i --save-dev @babel/core

npm i @babel/preset-env --save-dev
npm i @babel/preset-react --save-dev

and change the .babelrc

from

{
  "presets": [
    "react",
    [ "env", {
      "targets": {
        "browsers": "> 2%"
      }
    }]
  ],

  "plugins": [
    "react-hot-loader/babel"
  ]
}

to

{
  "presets": [
    "@babel/react",
    [ "@babel/env", {
      "targets": {
        "browsers": "> 2%"
      }
    }]
  ],

  "plugins": [
    "react-hot-loader/babel"
  ]
}

@robsonmrsp It should be fixed now. Please update and try again.