C
C
colorkid2018-08-29 13:41:17
JavaScript
colorkid, 2018-08-29 13:41:17

Webpack does not find module '@babel/core'. How to fix?

Hello. Webpack build issue. I installed babel and all its accessories, I run it, but it does not find the module, writes Cannot find module '@babel/core', BUT I have it in package.json.
webpack.config code

let path = require('path');

let conf = {
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, './dist'),
    filename: 'main.js',
    publicPath: 'dist/'
  },
  devServer: {
    overlay: true
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        loader: 'babel-loader'
        //exclude: '/node_modules/'
      }
    ]
  }
};

module.exports = conf;

package.json code
{
  "name": "webpacklolol",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "webpack-dev-server --mode development --open",
    "build": "webpack --mode production"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "babel-core": "^6.26.3",
    "babel-loader": "^8.0.0",
    "babel-preset-env": "^1.7.0",
    "babel-preset-stage-3": "^6.24.1",
    "path": "^0.12.7",
    "webpack": "^4.17.1",
    "webpack-cli": "^3.1.0",
    "webpack-dev-server": "^3.1.6"
  },
  "dependencies": {}
}

How to fix, because everything seems to work? Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2018-08-29
@colorkid

Some package of your dependencies requires babel 7+, and you have 6.
Read, update.
https://babeljs.io/blog/2018/08/27/7.0.0

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question