Module build failed: Error: Cannot find module '@babel/core'

So I am sort of new to webpack since I never created my own workflow and I am trying to set up an enviorement to compile ES2015+ JS and SCSS code now for the first time. For some reason when I try to compile my webpack I get the error Module build failed: Error: Cannot find module '@babel/core'. Yet I have installed it with npm install

Webpack.config.js

module.exports = {
    entry: './components/js/app.js',
    output: {
        filename: './dist/main.js'
    },
    module: {
        loaders: [
            {test: /\.js$/, loader: "babel-loader", exclude: /node_modules/},
            {test: /\.scss$/, loader: "style-loader!css-loader!sass-loader"}
        ],


    }
}

.babelrc

{
    "presets": [
        "@babel/preset-env"
    ]
}

Package.json

{
  "name": "webpack-env",
  "version": "1.0.0",
  "description": "Webpack",
  "main": "components/js/app.js",
  "scripts": {
    "build": "webpack"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/preset-env": "^7.0.0-beta.39",
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.2",
    "css-loader": "^0.28.5",
    "node-sass": "^4.5.3",
    "sass-loader": "^6.0.6",
    "style-loader": "^0.18.2",
    "webpack": "^3.4.1"
  },
  "dependencies": {}
}

Is there something I am missing?

Alright after some digging I've found the problem. The problem is that I've installed a newer version of babel, @babel/preset-env which is babel version 7. Version 6 isn't working that way (as I believe, not sure) and for version 6 you have to run npm install --save-dev babel-preset-env instead of npm install --save-dev @babel/preset-env as I did.

The .babelrc file becomes

{
  "presets": ["env"]
}

Module build failed, Error: Cannot find module '@babel/core' � Issue , Module build failed, Error: Cannot find module '@babel/core' #664. Closed. shardool opened this issue on Aug 27, 2018 � 10 comments. Closed� Dismiss Join GitHub today. GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.

This solved the issue for me for babel 7.

Inside .babelrc file

{
"presets": [
    [
      "@babel/preset-env",
      {
        "modules": "commonjs",
        "targets": {
          "node": "current"
        }
      }
    ]
  ]
}

https://github.com/babel/babel-loader/issues/616#issuecomment-386107677

Edit: This also works.

{ "presets": ["@babel/preset-env"] }

Module build failed: Error: Cannot find module "../math-constants , Module build failed: Error: Cannot find module "../math-constants" #11417. Closed. jimzhan opened this issue on Jul 23, 2018 � 4 comments. Closed� When I open my Discord, it sometimes doesnt work. After a while it gives me the message that the shortcut to my discord.exe doesn't exist anymore. Next time that I start up my laptop it gives me the error: Error: cannot find module build_info.json.

In order to use Babel 7, I believe your .babelrc file should have the following or similar:

{
  "presets": [
    [
      "@babel/preset-env", 
      {
        "targets": {
          "node": "current"
        }
      }
    ]
  ]
}

Module build failed: Error: Cannot find module 'babel-preset-env , When I run "npm run build" I get the error: "ERROR in ./src/main.js Module build failed: Error: Cannot find module 'babel-preset-env' from� I am trying to make custom theme working, but after I add theme.scss to the styles list in the angular-cli.json (as suggested in docs) and then start the project, I get the following error: Module build failed: Error: Cannot find module 'node-sass' I can't figure out what causes this issue. P.S. I installed the latest Angular Material version 5.0.0

Module build failed: Error: Cannot find module '@babel/core' � Issue , Module build failed: Error: Cannot find module '@babel/core' #3452. Closed. josh -gree opened this issue on Apr 19, 2018 � 7 comments. Closed� Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.

Module build failed (from ./node_modules/babel-loader/lib/index.js , node_modules/babel-loader/lib/index.js): Error: Cannot find module '@babel/ core' ERROR in ./src/index.js Module build failed (from . I can add one more place to check; the package that I was trying to use was another one of my own packages that I had published to a private NPM repo. I had forgotten to configure the 'main' property in the package.json properly. So, the package was there in the node_modules folder of the consuming package, but I was getting "cannot find module".

[Build] Failed to compile, [Build] Failed to compile | Error: [BABEL] index.js Cannot find module './src/data' # 8062. Closed. Fantasim opened this issue on Dec 2, 2019 � 22 comments. Config: macOS High Sierra, version 10.13.2, node:v8.1.2 npm:5.0.3 When I run npm start in my angularjs project I get this error: ERROR in Cannot find module 'node-sass' After this I run: npm i n