title: Heroku Build Fail [sh: 1: react-scripts: Permission denied]
body: <pre><code>    ----&gt; Node.js app detected
  
  -----&gt; Creating runtime environment
  
         NPM_CONFIG_LOGLEVEL=error
         NODE_ENV=production
         NODE_MODULES_CACHE=true
         NODE_VERBOSE=false
  
  -----&gt; Installing binaries
         engines.node (package.json):  unspecified
         engines.npm (package.json):   unspecified (use default)
  
         Resolving node version 12.x...
         Downloading and installing node 12.13.0...
         Using default npm version: 6.12.0
  
  -----&gt; Installing dependencies
         Prebuild detected (node_modules already exists)
         Rebuilding any native modules
  
         &gt; nodemon@1.19.3 postinstall /tmp/build_33db88ab97938128199a401d17366aac/node_modules/nodemon
         &gt; node bin/postinstall || exit 0
  
         Love nodemon? You can now support the project via the open collective:
  
  
            &gt; https://opencollective.com/nodemon/donate
  
  //REMOVED INSTALLATION TEXT HERE DUE TO CHAR LIMIT
  
  
  -----&gt; Build
         Running heroku-postbuild
  
         &gt; website_setup@1.0.0 heroku-postbuild /tmp/build_33db88ab97938128199a401d17366aac
         &gt; NPM_CONFIG_PRODUCTION=false npm install --prefix client &amp;&amp; npm run build --prefix client
  
         audited 905041 packages in 14.447s
         found 1 moderate severity vulnerability
           run `npm audit fix` to fix them, or `npm audit` for details
  
         &gt; client@0.1.0 build /tmp/build_33db88ab97938128199a401d17366aac/client
         &gt; react-scripts build
  
  sh: 1: react-scripts: Permission denied
  npm ERR! code ELIFECYCLE
  npm ERR! errno 126
  npm ERR! client@0.1.0 build: `react-scripts build`
  npm ERR! Exit status 126
  npm ERR! 
  npm ERR! Failed at the client@0.1.0 build script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /tmp/npmcache.1egfD/_logs/2019-11-08T01_04_59_454Z-debug.log
  npm ERR! code ELIFECYCLE
  npm ERR! errno 126
  npm ERR! website_setup@1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix client &amp;&amp; npm run build --prefix client`
  npm ERR! Exit status 126
  npm ERR! 
  npm ERR! Failed at the website_setup@1.0.0 heroku-postbuild script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /tmp/npmcache.1egfD/_logs/2019-11-08T01_04_59_470Z-debug.log
  -----&gt; Build failed
  
  
         We're sorry this build is failing! You can troubleshoot common issues here:
         https://devcenter.heroku.com/articles/troubleshooting-node-deploys
  
         Some possible problems:
  
         - node_modules checked into source control
           https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits
  
         - Node version not specified in package.json
           https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
  
         Love,
         Heroku
  
   !     Push rejected, failed to compile Node.js app.
   !     Push failed
  </code></pre>
  
  <p>Synopsis:</p>
  
  <p>I recently finished MERN stack course and went to go push my build to Heroku but encountered the error above. I first thought it was a visual studio permissions error so I ran vs code with elevated privileges. This, however, did not work.</p>
  
  <p>I've tried and had no success with:</p>
  
  <ol>
  <li>Adding a nodejs script build package to my deployment</li>
  <li>Modifying my package.json to incorporate engine which selects the version of node.js to run</li>
  <li>Adding .js extensions to the end of the server in the scripts section thinking there may be a simple issue with that</li>
  <li>Double checking that my local instance works properly (it does)</li>
  <li>Promptly throwing my computer out my window (feels pretty good, but still not working)</li>
  </ol>
  
  <p>Refer to this link to see how to check your file for the correct permissions and how to set them ( <a href="https://stackoverflow.com/questions/25730041/updating-file-permissions-with-git-bash-on-windows-7">Updating file permissions with git-bash on Windows 7</a> )</p>