Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR in Cannot find module 'babel-core'. using react.js, webpack, and express server

Whenever I run webpack in the terminal I get:

Hash: efea76b1048c3a97b963 Version: webpack 1.12.13 Time: 33ms     + 1 hidden modules  ERROR in Cannot find module 'babel-core' 

Here is my webpack.config.js file

module.exports = {   entry: './app-client.js',   output: {     filename: 'public/bundle.js'   },   module: {     loaders: [       {         exclude: /(node_modules|app-server.js)/,         loader: 'babel'       }     ]   } } 

package.json

{   "name": "react",   "version": "1.0.0",   "description": "React polling app",   "main": "app-client.js",   "dependencies": {     "babel-loader": "^6.2.2",     "bootstrap": "^3.3.6",     "express": "^4.13.4",     "react": "^0.14.7"   },   "devDependencies": {},   "scripts": {     "test": "echo \"Error: no test specified\" && exit 1"   },   "author": "",   "license": "ISC" } 
like image 840
Richard Bustos Avatar asked Feb 05 '16 02:02

Richard Bustos


People also ask

Can not find Babel core?

To solve the error "Cannot find module '@babel/core'", make sure to install the @babe/core package by opening your terminal in your project's root directory and running the following command: npm i -D @babel/core and restart your IDE and development server.

What does Babel node do?

Babel is a JavaScript compiler Babel is a toolchain that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers or environments.


1 Answers

You should install babel-loader and babel-core as dev-dependency while npm install.

npm install babel-core babel-loader --save-dev 
like image 181
Chetan Avatar answered Sep 19 '22 18:09

Chetan