Can’t deploy React app to Heroku

I've been going in circles trying to get my React app deployed to Heroku. I've been trying it with the Heroku CLI and constantly get the following:

remote: -----> Build failed remote: remote: ! Outdated Yarn lockfile remote: remote: Your application contains a Yarn lockfile (yarn.lock) which does not remote: match the dependencies in package.json. This can happen if you use npm remote: to install or update a dependency instead of Yarn. remote: remote: Please run the following command in your application directory and check remote: in the new yarn.lock file: remote: remote: $ yarn install remote: $ git add yarn.lock remote: $ git commit -m "Updated Yarn lockfile" remote: $ git push heroku master remote: remote: https://kb.heroku.com/why-is-my-node-js-build-failing-because-of-an-outdated-yarn-lockfile remote: remote: ! Push rejected, failed to compile React.js (create-react-app) multi app. remote: remote: ! Push failed 

I don't have a yarn.lock file installed (I did in an earlier git branch but it's long gone). Just for sake of it, I deleted my package.lock file and even my node modules, followed the instructions by installing yarn and still get the same error. I make sure to git add ., git commit -m 'xx' and git push heroku master but the same every time. My package.json file looks like this:

{ "name": "codecards-app", "version": "0.1.0", "private": true, "engines": { "node": "8.15.0", "npm": "6.9.0" }, "dependencies": { "@kennethormandy/react-flipcard": "^0.4.3", "create-react-class": "^15.6.3", "eslint-plugin-react": "^7.13.0", "prop-types": "^15.7.2", "react": "^16.8.6", "react-card-flip": "^0.7.1", "react-dom": "^16.8.6", "react-flipcard": "^0.2.1", "react-flipcard-2": "^0.3.2", "react-scripts": "3.0.1", "semantic-ui-react": "^0.87.1" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } } 

I also tried using the 'mars' buildpack claiming to be a' no config' way to deploy a React app to Heroku. I also tried using the direct deployment on the actual Heroku site by tapping directly into my Github account but there it fails because it can't read my .env file which has a global `REACT_APP_API_URI=<MY URL>` in it.

I'm not sure what to do any more. These seems pretty difficult.

submitted by /u/dsound
[link] [comments]
Source: Reddit