0

I'm keep getting the following error when I'm trying to deploy to heroku:

remote: sh: 1: react-scripts: Permission denied

The app compiles and workes well locally, so i'm pretty sure it's something with the deployment settings.

I can't understand what's wrong... here is my nodejs server package.json:

{
  "name": "app-server",
  "version": "1.0.0",
  "description": "Create-react-app with Express",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js",
    "heroku-postbuild": "cd client && npm install && npm run build"
  },
  "author": "Roy",
  "license": "ISC",
  "dependencies": {
    "axios": "^0.19.0",
    "cors": "^2.8.4",
    "dotenv": "^8.1.0",
    "express": "^4.16.3"
  },
  "engines": {
    "node": "10.5.0"
  }
}

And here is my client package.json

{
  "name": "client",
  "version": "0.1.0",
  "private": false,
  "dependencies": {
    "@material-ui/core": "^4.4.1",
    "axios": "^0.19.0",
    "color-temperature": "^0.2.7",
    "concurrently": "^4.1.2",
    "cors": "^2.8.5",
    "downshift": "^3.2.14",
    "express": "^4.17.1",
    "lodash": "^4.17.15",
    "moment": "^2.24.0",
    "path": "^0.12.7",
    "prop-types": "^15.7.2",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-md": "^1.12.3",
    "react-moment": "^0.9.2",
    "react-redux": "^7.0.2",
    "react-reveal": "^1.2.2",
    "react-router-dom": "^5.0.0",
    "react-scripts": "2.1.8",
    "react-toastify": "^5.3.2",
    "reactstrap": "^8.0.1",
    "redux": "^4.0.1",
    "redux-thunk": "^2.3.0"

  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },

  "proxy": "http://localhost:5000"
}

And here is the full error

  remote: sh: 1: react-scripts: Permission denied
    remote: npm ERR! code ELIFECYCLE
    remote: npm ERR! errno 126
    remote: npm ERR! [email protected] build: `react-scripts build`
    remote: npm ERR! Exit status 126
    remote: npm ERR!
    remote: npm ERR! Failed at the [email protected] build script.
    remote: npm ERR! This is probably not a problem with npm. There is likely additional logging 
    output above.
    remote:
    remote: npm ERR! A complete log of this run can be found in:
    remote: npm ERR!     /tmp/npmcache.cG6aC/_logs/2019-09-20T12_27_39_563Z-debug.log
    remote: npm ERR! code ELIFECYCLE
    remote: npm ERR! errno 126
    remote: npm ERR! [email protected] heroku-postbuild: `cd client && npm install && npm run 
     build`
    remote: npm ERR! Exit status 126
    remote: npm ERR!
    remote: npm ERR! Failed at the [email protected] heroku-postbuild script.
    remote: npm ERR! This is probably not a problem with npm. There is likely additional logging 
    output above.
    remote:
    remote: npm ERR! A complete log of this run can be found in:
    remote: npm ERR!     /tmp/npmcache.cG6aC/_logs/2019-09-20T12_27_39_576Z-debug.log
    remote:
    remote: -----> Build failed
    remote:
    remote:        We're sorry this build is failing! You can troubleshoot common issues here:
    remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
    remote:
    remote:        If you're stuck, please submit a ticket so we can help:
    remote:        https://help.heroku.com/
    remote:
    remote:        Love,
    remote:        Heroku
    remote:
    remote:  !     Push rejected, failed to compile Node.js app.
    remote:
    remote:  !     Push failed

1 Answer 1

1
  1. Have you ignored node modules?
  2. Have you checked that all module installations were correct without errors?
  3. In your client package.json the proxy is localhost. Try to replace it with your backend url.
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, i did followed this checklist but there was alot of other problems, so i what did that fix it was to deploy an empty project with both - node and react and then install each npm package one after another, and then deploy each component seperatly... i know it's a long way but i since i don't have any experience with Heroku - this way is more controlled

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.