can not push react git repo on heroku - reactjs

So I've cloned a github repo on my my own repo and did some edits. I'm trying to deploy it on heroku but I'm encountering errors I don't understand.
Can anyone provide step by step guide to fix the issues? or help me host the project? I'm a total noob at react.
-----> Building on the Heroku-20 stack
-----> Using buildpack: https://github.com/mars/create-react-app-buildpack.git
-----> React.js (create-react-app) multi app detected
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-multi.git
=====> Detected Framework: Multipack
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-nodejs.git
=====> Detected Framework: Node.js
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 14.x
engines.npm (package.json): unspecified (use default)
Resolving node version 14.x...
Downloading and installing node 14.17.3...
Using default npm version: 6.14.13
-----> Installing dependencies
Installing node modules
> sqlite3#5.0.2 install /tmp/build_c9b2026f/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build
[sqlite3] Success: "/tmp/build_c9b2026f/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.node" is installed via remote
> nodemon#2.0.7 postinstall /tmp/build_c9b2026f/node_modules/nodemon
> node bin/postinstall || exit 0
Love nodemon? You can now support the project via the open collective:
> https://opencollective.com/nodemon/donate
> node-sass#5.0.0 install /tmp/build_c9b2026f/node_modules/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v5.0.0/linux-x64-83_binding.node
Download complete
Binary saved to /tmp/build_c9b2026f/node_modules/node-sass/vendor/linux-x64-83/binding.node
Caching binary to /tmp/npmcache.Hxxdz/_cacache/node-sass/5.0.0/linux-x64-83_binding.node
> node-sass#5.0.0 postinstall /tmp/build_c9b2026f/node_modules/node-sass
> node scripts/build.js
Binary found at /tmp/build_c9b2026f/node_modules/node-sass/vendor/linux-x64-83/binding.node
Testing binary
Binary is fine
added 1408 packages in 19.854s
-----> Build
Running build
> show-me-the-money#0.4.0 build /tmp/build_c9b2026f
> run-p build:client build:server
> show-me-the-money#0.4.0 build:client /tmp/build_c9b2026f
> npm run webpack -- --mode production
> show-me-the-money#0.4.0 build:server /tmp/build_c9b2026f
> npm run knex -- migrate:latest
> show-me-the-money#0.4.0 knex /tmp/build_c9b2026f
> knex --knexfile ./server/db/knexfile.js "migrate:latest"
> show-me-the-money#0.4.0 webpack /tmp/build_c9b2026f
> webpack --config ./client/webpack.config.js "--mode" "production"
Working directory changed to /tmp/build_c9b2026f/server/db
Using environment: production
Error: Unable to acquire a connection
at Client_PG.acquireConnection (/tmp/build_c9b2026f/node_modules/knex/lib/client.js:339:13)
at Runner.ensureConnection (/tmp/build_c9b2026f/node_modules/knex/lib/runner.js:264:8)
at Runner.run (/tmp/build_c9b2026f/node_modules/knex/lib/runner.js:26:12)
at SchemaBuilder.Target.then (/tmp/build_c9b2026f/node_modules/knex/lib/interface.js:22:43)
at ensureTable (/tmp/build_c9b2026f/node_modules/knex/lib/migrate/table-creator.js:13:6)
at listCompleted (/tmp/build_c9b2026f/node_modules/knex/lib/migrate/migration-list-resolver.js:12:9)
at Object.listAllAndCompleted (/tmp/build_c9b2026f/node_modules/knex/lib/migrate/migration-list-resolver.js:28:5)
at Migrator.latest (/tmp/build_c9b2026f/node_modules/knex/lib/migrate/Migrator.js:64:57)
at Command.<anonymous> (/tmp/build_c9b2026f/node_modules/knex/bin/cli.js:171:55)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! show-me-the-money#0.4.0 knex: `knex --knexfile ./server/db/knexfile.js "migrate:latest"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the show-me-the-money#0.4.0 knex 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.Hxxdz/_logs/2021-07-20T09_05_44_051Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! show-me-the-money#0.4.0 build:server: `npm run knex -- migrate:latest`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the show-me-the-money#0.4.0 build:server 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.Hxxdz/_logs/2021-07-20T09_05_44_110Z-debug.log
ERROR: "build:server" exited with 1.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! show-me-the-money#0.4.0 build: `run-p build:client build:server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the show-me-the-money#0.4.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.Hxxdz/_logs/2021-07-20T09_05_44_162Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile React.js (create-react-app) multi app.
! Push failed
Here is link to my repo https://github.com/OsamaB7/Bartering

Related

React app Heroku deployment tree dependency error [duplicate]

I'm following this tutorial to deploy the Strapi app to Heroku.
I have set up to auto-deploy from my Github repo.
After pushing to Github, I get the notification of build failure with the following message.
build log
-----> Building on the Heroku-20 stack
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): >=10.16.0 <=14.x.x
engines.npm (package.json): >=6.0.0
Resolving node version >=10.16.0 <=14.x.x...
Downloading and installing node 14.15.4...
Bootstrapping npm >=6.0.0 (replacing 6.14.10)...
npm >=6.0.0 installed
-----> Installing dependencies
Installing node modules (package.json)
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: drkang-strapi#0.1.0
npm ERR! Found: knex#0.19.5
npm ERR! node_modules/knex
npm ERR! knex#"<0.20.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer knex#"^0.20.0" from strapi-connector-bookshelf#3.4.6
npm ERR! node_modules/strapi-connector-bookshelf
npm ERR! strapi-connector-bookshelf#"3.4.6" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /tmp/npmcache.9OnCF/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.9OnCF/_logs/2021-02-04T02_14_54_807Z-debug.log
-----> 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:
- Dangerous semver range (>) in engines.node
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
What should I do here? Any help would be appreciated.
I had the same issue today. It appears to me that the problem has to do with the version of knex not being compatible with the version of nodejs. After looking into it more, Strapi isn't compatible with nodejs over v.14 or npm over v.6 (Heroku was trying to build my Strapi app with node v.15). To resolve it, I updated the package.json file to make sure that Heroku uses the versions that are compatible. Here is what I added, it worked for me and I hope it works for you.
In the package.json file, update the versions of node and npm like this:
"engines": {
"node": "<=14.x.x",
"npm": "<=6.x.x"
}
In my case .npmrc solved this,
create .npmrc in the root of the project and allow legacy peer dependencies
legacy-peer-deps=true
Jryke's way solved my problem:
I added these lines to package.json and the problem fixed:
"engines": {
"node": "16.x",
"npm": "8.5.5"
},
And again thanks to Jryke :-) yes I use "knex" module in my code and yes I use "heroku" also.

Module not found: Error: Can't resolve 'bootstrap/dist/css/bootstrap.css' in '/codebuild/output/src489574561/src/user-management-frontend/src'

I'm trying to deploy a React App in AWS Amplify but during the Build process, AWS Amplify throws below error:
Module not found: Error: Can't resolve 'bootstrap/dist/css/bootstrap.css' in '/codebuild/output/src489574561/src/user-management-frontend/src'
I'm wondering how to solve this error by changing something in code or need to configure AWS Amplify.
Full log trace is here:
# Starting phase: preBuild
# Executing command: npm ci
2022-09-07T06:11:29.303Z [INFO]: > core-js#3.25.0 postinstall /codebuild/output/src489574561/src/user-management-frontend/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
2022-09-07T06:11:29.350Z [INFO]: [96mThank you for using core-js ([94m https://github.com/zloirock/core-js [96m) for polyfilling JavaScript standard library![0m
[96mThe project needs your help! Please consider supporting of core-js:[0m
[96m>[94m https://opencollective.com/core-js [0m
[96m>[94m https://patreon.com/zloirock [0m
[96m>[94m bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz [0m
[96mAlso, the author of core-js ([94m https://github.com/zloirock [96m) is looking for a good job -)[0m
2022-09-07T06:11:29.558Z [INFO]: > core-js-pure#3.25.0 postinstall /codebuild/output/src489574561/src/user-management-frontend/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"
2022-09-07T06:11:29.895Z [INFO]: added 1501 packages in 21.092s
2022-09-07T06:11:29.908Z [INFO]: # Completed phase: preBuild
# Starting phase: build
2022-09-07T06:11:29.908Z [INFO]: # Executing command: npm run build
2022-09-07T06:11:30.074Z [INFO]: > user-management-frontend#0.1.0 build /codebuild/output/src489574561/src/user-management-frontend
> react-scripts build
2022-09-07T06:11:31.296Z [INFO]: Creating an optimized production build...
2022-09-07T06:11:31.983Z [INFO]: Failed to compile.
2022-09-07T06:11:31.983Z [INFO]: Module not found: Error: Can't resolve 'bootstrap/dist/css/bootstrap.css' in '/codebuild/output/src489574561/src/user-management-frontend/src'
2022-09-07T06:11:31.994Z [WARNING]: npm
2022-09-07T06:11:31.994Z [WARNING]: ERR! code ELIFECYCLE
npm ERR! errno 1
2022-09-07T06:11:31.996Z [WARNING]: npm
2022-09-07T06:11:31.996Z [WARNING]: ERR! user-management-frontend#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the user-management-frontend#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2022-09-07T06:11:32.000Z [WARNING]:
2022-09-07T06:11:32.000Z [WARNING]: npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-09-07T06_11_31_997Z-debug.log
2022-09-07T06:11:32.000Z [HELP]: Outputting the npm debug log
[object Promise]
2022-09-07T06:11:32.003Z [ERROR]: !!! Build failed
2022-09-07T06:11:32.003Z [ERROR]: !!! Non-Zero Exit Code detected
2022-09-07T06:11:32.003Z [INFO]: # Starting environment caching...
2022-09-07T06:11:32.004Z [INFO]: # Environment caching completed
Terminating logging...
Try installing bootstrap, that's how I solved it.
npm install bootstrap --save

getting error while trying to create a react app

I used to create react apps with the facebook's github repo and it worked each time, but this time it is not working. Because I'm getting this error and I can't find the reason behind it. I've already tried to do the cache clean.
> core-js#2.6.12 postinstall C:\Users\user\Desktop\cryptohello\node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
The system cannot find the path specified.
npm ERR! code ELIFECYCLE
npm ERR! errno 3
npm ERR! core-js#2.6.12 postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the core-js#2.6.12 postinstall 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! C:\Users\user\AppData\Roaming\npm-cache\_logs\2021-08-15T16_48_09_293Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... node_modules
Deleting generated file... package.json
Deleting cryptohello/ from C:\Users\user\Desktop
Done.
The problem is you haven't support of fork, exec and bash in cmd in windows, please try with GIT Bash

Push rejected, failed to compile Node.js app in Reactjs on Heroku

-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 10.10.0
engines.npm (package.json): unspecified (use default)
Resolving node version 10.10.0...
Downloading and installing node 10.10.0...
Using default npm version: 6.4.1
-----> Installing dependencies
Installing node modules
> core-js#2.6.12 postinstall /tmp/build_8bed3db3/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> ejs#2.7.4 postinstall /tmp/build_8bed3db3/node_modules/ejs
> node ./postinstall.js
> fsevents#1.2.13 install /tmp/build_8bed3db3/node_modules/webpack-dev-server/node_modules/fsevents
> node install.js
Skipping 'fsevents' build as platform linux is not supported
> fsevents#1.2.13 install /tmp/build_8bed3db3/node_modules/watchpack-chokidar2/node_modules/fsevents
> node install.js
Skipping 'fsevents' build as platform linux is not supported
> core-js#3.14.0 postinstall /tmp/build_8bed3db3/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> core-js-pure#3.14.0 postinstall /tmp/build_8bed3db3/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"
added 1862 packages in 22.698s
-----> Build
Running build
> zitco_cms#0.1.0 build /tmp/build_8bed3db3
> react-scripts build
Creating an optimized production build...
Failed to compile.
createRequire is not a function
Referenced from: BaseConfig
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zitco_cms#0.1.0 build: react-scripts build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zitco_cms#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.qDSBm/_logs/2021-07-13T11_52_35_566Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed

react scripts build failed to compile

When deploying my create-react-app with heroku, My react scripts build fails, and it can not find some file.
But everything works just fine locally.
steps i did when deploying the app:
1) heroku create nameoftheApp --buildpack https://github.com/mars/create-react-app-buildpack.git.
2) run git push heroku master.
Thats all i did. Then I got the same error stating I have to Add node version. So I added the version. And this is what I got after adding the version and trying to redeploy again.
It might be stupid but I'm pretty new to Heroku (deploying apps in general) so im sorry about that.
remote: Creating an optimized production build...
remote: Failed to compile.
remote:
remote: ./src/components/pages/Home.js
remote: Cannot find file '../home-menu/MenuMain' in './src/components/pages'.
remote:
remote:
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! royal#0.1.0 build: `react-scripts build`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the royal#0.1.0 build script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Resources