title: Heroku ReactJS deployment
body: <p>I'm taking a ReactJS course, and I am on the final lesson, which is posting my app to Heroku. However, whenever I try to do this, I get these errors:</p>
  <pre><code>    /tmp/build_64ba7376/node_modules/webpack-cli/bin/cli.js:93
              throw err;
              ^
  Error: Cannot find module 'uglifyjs-webpack-plugin'
  
  </code></pre>
  <p>...</p>
  <pre><code>remote: npm ERR! code ELIFECYCLE
  remote: npm ERR! errno 1
  remote: npm ERR! react-project@1.0.0 build: `cross-env NODE_ENV=production webpack --config webpack/prod.config.js --progress --display-error-details --color
  </code></pre>
  <p>...</p>
  <pre><code>To https://git.heroku.com/tvh-bottega-react-js-project.git
   ! [remote rejected] main -&gt; main (pre-receive hook declined)
  error: failed to push some refs to 'https://git.heroku.com/tvh-bottega-react-js-project.git'
  </code></pre>
  <p>And these are the app's dependencies:</p>
  <pre><code>&quot;dependencies&quot;: {​​​​​​​​
  &quot;@fortawesome/fontawesome-svg-core&quot;: &quot;^1.2.35&quot;,
  &quot;@fortawesome/free-solid-svg-icons&quot;: &quot;^5.15.3&quot;,
  &quot;@fortawesome/react-fontawesome&quot;: &quot;^0.1.14&quot;,
  &quot;ajv&quot;: &quot;6.12.0&quot;,
  &quot;autoprefixer&quot;: &quot;^9.1.0&quot;,
  &quot;axios&quot;: &quot;^0.21.1&quot;,
  &quot;babel-cli&quot;: &quot;^6.26.0&quot;,
  &quot;babel-core&quot;: &quot;^6.26.3&quot;,
  &quot;babel-eslint&quot;: &quot;^7.2.3&quot;,
  &quot;babel-loader&quot;: &quot;^7.1.5&quot;,
  &quot;babel-plugin-async-to-promises&quot;: &quot;^1.0.5&quot;,
  &quot;babel-plugin-transform-runtime&quot;: &quot;^6.23.0&quot;,
  &quot;babel-polyfill&quot;: &quot;^6.26.0&quot;,
  &quot;babel-preset-env&quot;: &quot;^1.7.0&quot;,
  &quot;clean-webpack-plugin&quot;: &quot;^0.1.16&quot;,
  &quot;copy-webpack-plugin&quot;: &quot;^4.5.2&quot;,
  &quot;cross-env&quot;: &quot;^5.2.0&quot;,
  &quot;css-loader&quot;: &quot;^1.0.0&quot;,
  &quot;debug&quot;: &quot;^2.6.9&quot;,
  &quot;draft-js&quot;: &quot;^0.11.7&quot;,
  &quot;draftjs-to-html&quot;: &quot;^0.9.1&quot;,
  &quot;eslint&quot;: &quot;^4.2.0&quot;,
  &quot;eslint-loader&quot;: &quot;^1.9.0&quot;,
  &quot;eslint-plugin-react&quot;: &quot;^7.1.0&quot;,
  &quot;express&quot;: &quot;4.17.1&quot;,
  &quot;extract-loader&quot;: &quot;^2.0.1&quot;,
  &quot;file-loader&quot;: &quot;^1.1.11&quot;,
  &quot;html-loader&quot;: &quot;^0.5.5&quot;,
  &quot;html-to-draftjs&quot;: &quot;^1.5.0&quot;,
  &quot;html-webpack-plugin&quot;: &quot;^3.2.0&quot;,
  &quot;moment&quot;: &quot;^2.29.1&quot;,
  &quot;node-sass&quot;: &quot;^4.13.1&quot;,
  &quot;postcss-loader&quot;: &quot;^2.1.6&quot;,
  &quot;react&quot;: &quot;16.13.1&quot;,
  &quot;react-dom&quot;: &quot;16.13.1&quot;,
  &quot;react-draft-wysiwyg&quot;: &quot;^1.14.7&quot;,
  &quot;react-dropzone-component&quot;: &quot;^3.2.0&quot;,
  &quot;react-html-parser&quot;: &quot;^2.0.2&quot;,
  &quot;react-modal&quot;: &quot;^3.14.3&quot;,
  &quot;react-redux&quot;: &quot;7.2.0&quot;,
  &quot;react-router&quot;: &quot;5.1.2&quot;,
  &quot;react-router-dom&quot;: &quot;5.1.2&quot;,
  &quot;react-truncate&quot;: &quot;^2.4.0&quot;,
  &quot;redux&quot;: &quot;4.0.5&quot;,
  &quot;sass-loader&quot;: &quot;^7.1.0&quot;,
  &quot;striptags&quot;: &quot;^3.2.0&quot;,
  &quot;style-loader&quot;: &quot;^0.21.0&quot;,
  &quot;webpack&quot;: &quot;4.42.1&quot;,
  &quot;webpack-cli&quot;: &quot;3.3.11&quot;,
  &quot;webpack-dev-middleware&quot;: &quot;3.7.2&quot;,
  &quot;webpack-dev-server&quot;: &quot;3.10.3&quot;,
  &quot;webpack-hot-middleware&quot;: &quot;2.25.0&quot;,
  &quot;webpack-merge&quot;: &quot;4.2.2&quot;
  }​​​​​​​​,
  &quot;devDependencies&quot;: {​​​​​​​​
      &quot;babel-plugin-transform-class-properties&quot;: &quot;^6.24.1&quot;,
      &quot;babel-plugin-transform-object-rest-spread&quot;: &quot;^6.26.0&quot;,
      &quot;babel-preset-react&quot;: &quot;^6.24.1&quot;,
      &quot;babel-register&quot;: &quot;^6.26.0&quot;,
      &quot;extract-text-webpack-plugin&quot;: &quot;^4.0.0-beta.0&quot;,
      &quot;uglifyjs-webpack-plugin&quot;: &quot;^1.3.0&quot;
    }​​​​​​​​
  </code></pre>
  <p>NPM (version 6.x I believe), NodeJS(I think the latest version), Axios, React Dropzone Component, Font Awesome, React Modal Library, DraftJS, React HTML Parser, Striptags, and Truncate packages installed. I've tried re-installing uglifyjs but still get the same error. I've tried to repair npm (as it has some errors), but every attempt ends in failure (it says something about Python in the stack trace).</p>
  <p>I've followed along with Heroku's basic troubleshooting guides, but my builds always fail at this stage. What should I do to fix this?</p>