After upgrading npm, webpack errors showing

Viewed 218

After I upgraded the npm package to the latest one, 8.2.0 I started getting problems in react application. here is the screen shot.

enter image description here

here is what I see in console:

[HMR] Waiting for update signal from WDS... react-dom.development.js:12 Uncaught ReferenceError: run is not defined at Object../node_modules/react-dom/cjs/react-dom.development.js (:3000/static/js/vendors~main.chunk.js:199910) at webpack_require (:3000/static/js/bundle.js:857) at fn (:3000/static/js/bundle.js:151) at Object../node_modules/react-dom/index.js (:3000/static/js/vendors~main.chunk.js:225957) at webpack_require (:3000/static/js/bundle.js:857) at fn (:3000/static/js/bundle.js:151) at Module. (:3000/static/js/main.chunk.js:4506) at Module../src/index.tsx (:3000/static/js/main.chunk.js:4643) at webpack_require (:3000/static/js/bundle.js:857) at fn (:3000/static/js/bundle.js:151) at Object.1 (:3000/static/js/main.chunk.js:4657) at webpack_require (:3000/static/js/bundle.js:857) at checkDeferredModules (:3000/static/js/bundle.js:46) at Array.webpackJsonpCallback [as push] (:3000/static/js/bundle.js:33) at :3000/static/js/main.chunk.js:1 webpackHotDevClient.js:138 src/App.tsx

However when I build it and run it using nginx or serve -s build the app runs just fine as it should. it's just that npm start works and app shows all these errors.

1 Answers

Ok after researching much I was able to solve the issue by issuing two commands

npm -rf node_modules/
npm install

it's like reinstalling the project dependencies. No change in code or any other file was needed. I still do not know what caused it and why the dependency suddenly got issues with np upgrade but now it's working again.

Related