title: React: "react-scripts start" cannot find module webpack
body: <p>I am getting this error when I am not even using webpack in this particular branch. I have never encountered this error in my <strong>main</strong> branch before. However, I wanted to learn webpack so I created a <strong>webpack</strong> branch of my project and install webpack in that branch(Assuming that I did correctly install webpack locally). Now when I switch back to my <strong>main</strong>, and tried to run "<code>npm start</code>". I am getting into this error.</p>
  
  <pre><code>&gt; react-scripts start
  
  module.js:550
      throw err;
      ^
  
  Error: Cannot find module 'webpack'
      at Function.Module._resolveFilename (module.js:548:15)
      at Function.Module._load (module.js:475:25)
      at Module.require (module.js:597:17)
      at require (internal/module.js:11:18)
      at Object.&lt;anonymous&gt; (C:\Users\pzheng\my-app\node_modules\webpack-dev-server\lib\Server.js:22:17)
      at Module._compile (module.js:653:30)
      at Object.Module._extensions..js (module.js:664:10)
      at Module.load (module.js:566:32)
      at tryModuleLoad (module.js:506:12)
      at Function.Module._load (module.js:498:3)
  </code></pre>
  
  <p>When I tried to run "npm run build", this error appears instead:</p>
  
  <pre><code>Error: Cannot find module 'webpack/lib/Chunk'
      at Function.Module._resolveFilename (module.js:548:15)
      at Function.Module._load (module.js:475:25)
      at Module.require (module.js:597:17)
      at require (internal/module.js:11:18)
      at Object.&lt;anonymous&gt; (C:\Users\pzheng\my-app\node_modules\extract-text-webpack-plugin\dist\index.js:17:14)
      at Module._compile (module.js:653:30)
      at Object.Module._extensions..js (module.js:664:10)
      at Module.load (module.js:566:32)
      at tryModuleLoad (module.js:506:12)
      at Function.Module._load (module.js:498:3)
      at Module.require (module.js:597:17)
      at require (internal/module.js:11:18)
      at Object.&lt;anonymous&gt; (C:\Users\pzheng\my-app\node_modules\extract-text-webpack-plugin\dist\cjs.js:3:18)
      at Module._compile (module.js:653:30)
      at Object.Module._extensions..js (module.js:664:10)
      at Module.load (module.js:566:32)
  </code></pre>
  
  <p>Many SO posts suggesting downloading webpack, but I do not wish to use webpack for this branch, so many SO posts are not helpful.</p>
  
  <p><strong>What I have tried:</strong>
  I checked my <code>package.json file</code>, there is no webpack dependency in my <strong>main</strong> branch. However, I do see webpack in my <code>package.lock.json</code> file when I search for the word <code>webpack</code></p>
  
  <p><strong>What I am using:</strong>
  I am using <code>create-react-app</code> library. </p>
  
  <p><strong>What I need help with:</strong>
  I am trying to figure out the cause of this error and how to fix it. Does it have to do with me installing webpack in the other branch?</p>