Cannot find module 'webpack'

The package-lock.json sets your currently installed version of each package in stone and npm will use those exact versions when running npm install

When the dependency versions are corrupted, it leads to this error. It can be resolved easily by resetting the dependencies and installing afresh

  1. Delete
    • package–lock.json (NOT package.json)
    • node_modules
  2. Execute the command npm install

Verify whether package–lock.json is created and node_modules folder is added to your project

navigation