Rahul Dagli
Rahul Dagli

Reputation: 4502

Error: Babel polyfill is required although its already installed

After I installed bootstrap-loader in webpack i'm getting this error:

ERROR in 
      For Node <= v0.12.x Babel polyfill is required.
      Make sure it's installed in your 'node_modules/' directory.

 @ /Users/user/~/bootstrap-loader/loader.js 1:0-44 

Although I've already installed babel polyfill and included in webpack.config.js. I do not have node_modules folder created.

Webpack.config.js

var webpack = require('webpack');
var path = require('path');

var BUILD_DIR = path.resolve(__dirname, 'build');
var APP_DIR = path.resolve(__dirname, 'src');

module.exports = {
    entry: [
        // Set up an ES6-ish environment
        'babel-polyfill',
        'bootstrap-loader',
        APP_DIR + '/import.js',
    ],
    output: {
        path: BUILD_DIR,
        filename: 'bundle.js'
    },
    module: {
        loaders: [
            {
                test: /\.jsx?$/,
                loader: 'babel',

                exclude: /node_modules/,
                query: {
                    plugins: ['transform-runtime'],
                    presets: ['es2015', 'stage-0', 'react']
                }
            },
            {
                test: /\.css$/,
                loader: "style-loader!css-loader"
            }
        ]
    },
    plugins: [
        new webpack.ProvidePlugin({
            $: "jquery",
            jQuery: "jquery"
        })
    ]
};

Upvotes: 1

Views: 443

Answers (1)

Muki
Muki

Reputation: 3641

I resolved this issue by updating my nodejs version. Previously I had 0.10.x and I installed 5.5.0.

See Installing Nodejs via Package-Manager on how to install it.

Upvotes: 1

Related Questions