React, Redux webpack error

Viewed 1890

I just created a simple project with create-react-app with npm. I run the project and everything was ok. Then I installed redux with npm install redux --save and react-redux with npm install react-redux --save. I refresh the page again and it was working. Then I import Provider from 'react-redux' and wrapped my <App /> in Provider and I got the following error.

(webpack)/buildin/global.js
Module build failed: Error: ENOENT: no such file or directory, open '/Users/kahn/Desktop/react-redux-course/practice-rdx/node_modules/webpack/buildin/global.js'

Then I removed the import Provider but I am still getting the following error.

Html Webpack Plugin:
  Error: Child compilation failed:
  Module build failed: Error: ENOENT: no such file or directory, open '/Users/kahn/Desktop/react-redux-course/practice-rdx/node_modules/webpack/buildin  /global.js':
  Error: ENOENT: no such file or directory, open '/Users/kahn/Desktop/rea  ct-redux-course/practice-rdx/node_modules/webpack/buildin/global.js'
  Module build failed: Error: ENOENT: no such file or directory, open '/Users/kahn/Desktop/react-redux-course/practice-rdx/node_modules/webpack/buildin  /module.js':
  Error: ENOENT: no such file or directory, open '/Users/kahn/Desktop/rea  ct-redux-course/practice-rdx/node_modules/webpack/buildin/module.js'

  - compiler.js:76 
    [practice-rdx]/[html-webpack-plugin]/lib/compiler.js:76:16

What am I doing wrong? Is there any problem with my npm?

1 Answers

The HtmlWebpackPlugin has a bad cache. Set it to false (temporarily):

const html = new HtmlWebpackPlugin({
    template: path.join(ROOT, 'src', 'index.html'),
    cache: false
});
Related