I cant deploy in heroku my app something wrong with node.js , i tried to delete app , did again the app, npm install, install build packs, all what i saw for internet i did but i cant resolve the problem. The error is:
-----> 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): 14.x
engines.npm (package.json): unspecified (use default)
Resolving node version 14.x...
Downloading and installing node 14.16.1...
Using default npm version: 6.14.12
-----> Installing dependencies
Installing node modules
> react-redux-router#1.0.0 preinstall /tmp/build_94f5a392
> npm set audit false
> fsevents#1.2.13 install /tmp/build_94f5a392/node_modules/fsevents
> node install.js
Skipping 'fsevents' build as platform linux is not supported
> node-sass#4.14.1 install /tmp/build_94f5a392/node_modules/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/linux-x64-83_binding.node
Download complete
Binary saved to /tmp/build_94f5a392/node_modules/node-sass/vendor/linux-x64-83/binding.node
Caching binary to /tmp/npmcache.fQ3DD/_cacache/node-sass/4.14.1/linux-x64-83_binding.node
> node-sass#4.14.1 postinstall /tmp/build_94f5a392/node_modules/node-sass
> node scripts/build.js
Binary found at /tmp/build_94f5a392/node_modules/node-sass/vendor/linux-x64-83/binding.node
Testing binary
Binary is fine
> core-js#2.6.12 postinstall /tmp/build_94f5a392/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
added 1362 packages in 18.728s
-----> Build
Detected both "build" and "heroku-postbuild" scripts
Running heroku-postbuild
> react-redux-router#1.0.0 heroku-postbuild /tmp/build_94f5a392
> npm run build
> react-redux-router#1.0.0 build /tmp/build_94f5a392
> cross-env NODE_ENV=production webpack --config webpack/prod.config.js --progress --display-error-details --color
clean-webpack-plugin: /tmp/build_94f5a392/dist has been removed.
<s> [webpack.Progress] 70% building 443/443 modules 0 active
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-redux-router#1.0.0 build: `cross-env NODE_ENV=production webpack --config webpack/prod.config.js --progress --display-error-details --color`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-redux-router#1.0.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.fQ3DD/_logs/2021-04-21T16_54_17_773Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-redux-router#1.0.0 heroku-postbuild: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-redux-router#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.fQ3DD/_logs/2021-04-21T16_54_17_803Z-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
i tried all what i saw, my package.json:
{
"name": "react-redux-router",
"version": "1.0.0",
"description": "Basic skeleton codebase for React/Redux/Router applications.",
"engines": {
"node": "14.x"
},
"scripts": {
"preinstall": "npm set audit false",
"start": "webpack-dev-server --config webpack/dev.config.js --watch",
"build": "cross-env NODE_ENV=production webpack --config webpack/prod.config.js --progress --display-error-details --color",
"heroku-postbuild": "npm run build",
"precommit": "eslint src",
"prod": "NODE_ENV=production node server.js"
},
what can i do?
Need more details?
Thanks for help
I instaled the buildpacks again and now th error changes, now is this:
code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! react-redux-router#1.0.0 build: `cross-env NODE_ENV=production webpack --config webpack/prod.config.js --progress --display-error-details --color`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the react-redux-router#1.0.0 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.LI5Fz/_logs/2021-04-21T18_05_53_894Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! react-redux-router#1.0.0 heroku-postbuild: `npm run build`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the react-redux-router#1.0.0 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.LI5Fz/_logs/2021-04-21T18_05_53_921Z-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
remote: !
remote: ! ## Warning - The same version of this code has already been built: 31c1685dcd402b6a2bc433e60e53fd96f074132a
remote: ! We have detected that you have triggered a build from source code with version 31c1685dcd402b6a2bc433e60e53fd96f074132a
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku <branchname>:main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to funnybooks.
remote:
To https://git.heroku.com/funnybooks.git
! [remote rejected] HEAD -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/funnybooks.git'
Related
I'm trying to create an app on Heroku using git push heroku --force (I'm having trouble integrating remote changes) and keep running into issues while installing dependencies.
Any help is appreciated!
This is the build log:
Enumerating objects: 859, done.
Counting objects: 100% (859/859), done.
Delta compression using up to 4 threads
Compressing objects: 100% (349/349), done.
Writing objects: 100% (859/859), 1.35 MiB | 652.00 KiB/s, done.
Total 859 (delta 479), reused 832 (delta 463), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-22 stack
remote: -----> Using buildpack: heroku/nodejs
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 17.9.0
remote: engines.npm (package.json): 8.5.5
remote:
remote: Resolving node version 17.9.0...
remote: Downloading and installing node 17.9.0...
remote: npm 8.5.5 already installed with node
remote:
remote: -----> Restoring cache
remote: Cached directories were not restored due to a change in version of node, npm, yarn or stack
remote: Module installation may take longer for this build
remote:
remote: -----> Installing dependencies
remote: Installing node modules (package.json)
remote:
remote: > it-project-gekko#1.0.0 install
remote: > cd client && npm install && cd ../server && npm install
remote:
remote: npm ERR! code ERESOLVE
remote: npm ERR! ERESOLVE unable to resolve dependency tree
remote: npm ERR!
remote: npm ERR! While resolving: client#0.1.0
remote: npm ERR! Found: react#18.2.0
remote: npm ERR! node_modules/react
remote: npm ERR! react#"^18.2.0" from the root project
remote: npm ERR!
remote: npm ERR! Could not resolve dependency:
remote: npm ERR! peer react#"^17.0.1" from react-card-flip#1.1.5
remote: npm ERR! node_modules/react-card-flip
remote: npm ERR! react-card-flip#"^1.1.5" from the root project
remote: npm ERR!
remote: npm ERR! Fix the upstream dependency conflict, or retry
remote: npm ERR! this command with --force, or --legacy-peer-deps
remote: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
remote: npm ERR!
remote: npm ERR! See /tmp/npmcache.4IXqU/eresolve-report.txt for a full report.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.4IXqU/_logs/2022-09-24T14_19_38_390Z-debug-0.log
remote: npm ERR! code 1
remote: npm ERR! path /tmp/build_d873d808
remote: npm ERR! command failed
remote: npm ERR! command sh -c cd client && npm install && cd ../server && npm install
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.4IXqU/_logs/2022-09-24T14_19_22_510Z-debug-0.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
This is my package.json:
{
"name": "it-project-gekko",
"version": "1.0.0",
"description": "To run locally (tobe updated):",
"main": "server/app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "if-env NODE_ENV=production && npm run start:prod || npm run start:dev",
"start:prod": "cd server && npm run start",
"start:dev": "concurrently \"npm run server\" \"npm run client\" -k",
"client": "cd client && npm run start",
"server": "cd server && npm run dev",
"install": "cd client && npm install && cd ../server && npm install",
"build": "cd client && npm run build"
},
"engines": {
"node": "17.9.0",
"npm": "8.5.5"
},
"repository": {
"type": "git",
"url": "git+https://github.com/lequangtri20/it-project-gekko.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/lequangtri20/it-project-gekko/issues"
},
"homepage": "https://github.com/lequangtri20/it-project-gekko#readme",
"dependencies": {
"axios": "^0.27.2",
"concurrently": "^7.3.0",
"if-env": "^1.0.4",
"styled-components": "^5.3.5"
},
"devDependencies": {
"eslint": "^8.22.0",
"eslint-plugin-react": "^7.30.1"
}
}
Looking at answers to similar posts, I've added the my local node and npm versions.
"engines": {
"node": "17.9.0",
"npm": "8.5.5"
},
However, it didn't solve the problem.
I'm not sure if this would resolve it, but try typing into the terminal: npm install --force
I am following a Udemy course and the github repo is located here: https://github.com/StephenGrider/FullstackReactCode. The error occurs when I try to deploy the application to git and push to Heroku. When I follow these steps Heroku is supposed to automatically install all of the project's server-side dependencies which is caused by a 'heroku-postbuild' script in the server-side-folder JSON package. After Heroku runs all of the server's dependencies, it is supposed to automatically run a 'heroku-postbuild' script that instructs Heroku to (1) install all of the client-side dependencies in the client-side-folder JSON package and then (2) run the command 'npm run build' from within the client-folder directory. After these steps Heroku is supposed to try to start the application but I get the error below. FYI--I followed the directions within the error message but they didn't work. I've also included links to suggested solutions but they don't match my project's package.json structures so the solutions aren't helpful. I've also tried to install eslint as a dependency in both JSON packages but that hasn't worked either.
Possible solutions:
Why is 'type: module' in package.json file?
https://github.com/eslint/eslint/issues/14137
ESlint - Error: Must use import to load ES Module
This is my error:
$ git push heroku master
Enumerating objects: 74, done.
Counting objects: 100% (74/74), done.
Delta compression using up to 12 threads
Compressing objects: 100% (59/59), done.
Writing objects: 100% (63/63), 170.95 KiB | 5.18 MiB/s, done.
Total 63 (delta 17), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/nodejs
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 12.16.3
remote: engines.npm (package.json): 6.14.4
remote:
remote: Resolving node version 12.16.3...
remote: Downloading and installing node 12.16.3...
remote: npm 6.14.4 already installed with node
remote:
remote: -----> Restoring cache
remote: - node_modules
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote:
remote: > nodemon#2.0.15 postinstall /tmp/build_fc9f4df1/node_modules/nodemon
remote: > node bin/postinstall || exit 0
remote:
remote: Love nodemon? You can now support the project via the open collective:
remote: > https://opencollective.com/nodemon/donate
remote:
remote: added 295 packages in 4.112s
remote:
remote: -----> Build
remote: Running heroku-postbuild
remote:
remote: > server#1.0.0 heroku-postbuild /tmp/build_fc9f4df1
remote: > NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
remote:
remote:
remote: > core-js#3.21.1 postinstall /tmp/build_fc9f4df1/client/node_modules/core-js
remote: > node -e "try{require('./postinstall')}catch(e){}"
remote:
remote:
remote: > core-js-pure#3.21.1 postinstall /tmp/build_fc9f4df1/client/node_modules/core-js-pure
remote: > node -e "try{require('./postinstall')}catch(e){}"
remote:
remote: added 1434 packages from 699 contributors and audited 1436 packages in 19.485s
remote:
remote: 169 packages are looking for funding
remote: run `npm fund` for details
remote:
remote: found 4 moderate severity vulnerabilities
remote: run `npm audit fix` to fix them, or `npm audit` for details
remote:
remote: > client#0.1.0 build /tmp/build_fc9f4df1/client
remote: > react-scripts build
remote:
remote: Creating an optimized production build...
remote: Failed to compile.
remote:
remote: Must use import to load ES Module: /tmp/build_fc9f4df1/client/node_modules/#eslint/eslintrc/universal.js
remote: require() of ES modules is not supported.
remote: require() of /tmp/build_fc9f4df1/client/node_modules/#eslint/eslintrc/universal.js from
/tmp/build_fc9f4df1/client/node_modules/eslint/lib/linter/linter.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
remote: Instead rename universal.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /tmp/build_fc9f4df1/client/node_modules/#eslint/eslintrc/package.json.
remote:
remote:
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! client#0.1.0 build: `react-scripts build`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the client#0.1.0 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.fuU8Z/_logs/2022-03-18T18_29_34_363Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! server#1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the server#1.0.0 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.fuU8Z/_logs/2022-03-18T18_29_34_382Z-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
remote: Verifying deploy...
remote:
remote: ! Push rejected to stormy-journey-31783.
remote:
To https://git.heroku.com/stormy-journey-31783.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/stormy-journey-31783.git'
This is my Heroku Build Log:
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/nodejs
-----> 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): 12.16.3
engines.npm (package.json): 6.14.4
Resolving node version 12.16.3...
Downloading and installing node 12.16.3...
npm 6.14.4 already installed with node
-----> Restoring cache
- node_modules
-----> Installing dependencies
Installing node modules
> nodemon#2.0.15 postinstall /tmp/build_40a7066f/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
added 228 packages in 3.89s
-----> Build
Running heroku-postbuild
> server#1.0.0 heroku-postbuild /tmp/build_40a7066f
> NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
> core-js#3.21.1 postinstall /tmp/build_40a7066f/client/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> core-js-pure#3.21.1 postinstall /tmp/build_40a7066f/client/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"
added 1435 packages from 699 contributors and audited 1437 packages in 20.981s
169 packages are looking for funding
run `npm fund` for details
found 4 moderate severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
> client#0.1.0 build /tmp/build_40a7066f/client
> react-scripts build
Creating an optimized production build...
Failed to compile.
Must use import to load ES Module: /tmp/build_40a7066f/client/node_modules/#eslint/eslintrc/universal.js
require() of ES modules is not supported.
require() of /tmp/build_40a7066f/client/node_modules/#eslint/eslintrc/universal.js from /tmp/build_40a7066f/client/node_modules/eslint/lib/linter/linter.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename universal.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /tmp/build_40a7066f/client/node_modules/#eslint/eslintrc/package.json.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
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.PAGiQ/_logs/2022-03-15T22_15_39_679Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! server#1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the server#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.PAGiQ/_logs/2022-03-15T22_15_39_694Z-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
This is my package.json file in the server-side folder directory:
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"engines": {
"node": "12.16.3",
"npm": "6.14.4"
},
"scripts": {
"start": "node index",
"server": "nodemon index",
"client": "npm run start --prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\"",
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
},
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.2",
"concurrently": "^7.0.0",
"cookie-session": "^2.0.0",
"eslint": "^8.11.0",
"express": "^4.17.1",
"mongoose": "^6.2.4",
"nodemon": "^2.0.15",
"passport": "^0.5.2",
"passport-google-oauth20": "^2.0.0",
"stripe": "^8.209.0"
}
}
This is my package.json file in the client-side folder directory:
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^5.16.2",
"#testing-library/react": "^12.1.4",
"#testing-library/user-event": "^13.5.0",
"axios": "^0.26.1",
"eslint": "^8.11.0",
"http-proxy-middleware": "^2.0.3",
"materialize-css": "^1.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "^7.2.6",
"react-router-dom": "^5.3.0",
"react-scripts": "5.0.0",
"react-stripe-checkout": "^2.6.3",
"redux": "^4.1.2",
"redux-thunk": "^2.4.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
I'm having trouble getting my application on Heroku, I'm getting the following error, I've already searched around here on Stackoverflow and I've seen responses saying to remove /node_modules and package-lock.json, but unfortunately the error remains.
Output:
-----> 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): 14.16.1
engines.npm (package.json): unspecified (use default)
Resolving node version 14.16.1...
Downloading and installing node 14.16.1...
Using default npm version: 6.14.12
-----> Installing dependencies
Installing node modules
> nodemon#2.0.15 postinstall /tmp/build_1e107d4a/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
added 208 packages in 3.879s
-----> Build
Running build
> teste#1.0.0 build /tmp/build_1e107d4a
> concurrently "cd airbnb/ && npm run build"
[0]
[0] > airbnb#0.1.0 build /tmp/build_1e107d4a/airbnb
[0] > react-scripts build
[0]
[0] sh: 1: react-scripts: not found
[0] npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
[0] npm ERR! file sh
npm ERR! errno ENOENT
[0] npm ERR! airbnb#0.1.0 build: `react-scripts build`
[0] npm ERR! spawn ENOENT
[0] npm ERR!
[0] npm ERR! Failed at the airbnb#0.1.0 build script.
[0] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[0]
[0] npm ERR! A complete log of this run can be found in:
[0] npm ERR! /tmp/npmcache.ZNegh/_logs/2021-11-16T19_01_58_803Z-debug.log
[0] cd airbnb/ && npm run build exited with code 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! teste#1.0.0 build: `concurrently "cd airbnb/ && npm run build"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the teste#1.0.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.ZNegh/_logs/2021-11-16T19_01_58_824Z-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
Ok, the problem is with react-script, react-scripts is (by default) a devDependency for CRA apps, but Heroku Node buildpack has environment NODE_ENV=production which causes npm install to skip devDeps.
To install those devDeps too:
npm install --only=dev && npm install && npm run build
additional information.
Please check in your server-side (if you are using it)/add Procfile without any extension in the root directory.
and inside the Procfile add web: node here your main file name, for example, index.js in my case.
Please add your pacacge.js code as well so it helps us to help you better.
When deploying a fullstack Javascript app to Heroku, I receive the following error:
Error: Cannot find module 'node-linux-x64/package.json'
There's also a syntax error, but I don't believe that's the cause.
I'm a Mac user, so I'm unsure of what's going on. I've checked for the syntax error, but found nothing. I also tried uninstalling and reinstalling Node, etc...
Output:
remote: -----> Installing dependencies
remote: Prebuild detected (node_modules already exists)
remote: Rebuilding any native modules
remote:
remote: > node#12.4.0 preinstall /tmp/build_133f585dc02170b5c24a22d3bb3002bd/node_modules/node
remote: > node installArchSpecificPackage
remote:
remote: /tmp/build_133f585dc02170b5c24a22d3bb3002bd/node_modules/node/node_modules/.bin/node: 1: /tmp/build_133f585dc02170b5c24a22d3bb3002bd/node_modules/node/node_modules/.bin/node: �����: not found
remote: /tmp/build_133f585dc02170b5c24a22d3bb3002bd/node_modules/node/node_modules/.bin/node: 41: /tmp/build_133f585dc02170b5c24a22d3bb3002bd/node_modules/node/node_modules/.bin/node: Syntax error: ")" unexpected
remote: internal/modules/cjs/loader.js:638
remote: throw err;
remote: ^
remote:
remote: Error: Cannot find module 'node-linux-x64/package.json'
remote: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
remote: at Function.resolve (internal/modules/cjs/helpers.js:33:19)
remote: at ChildProcess.<anonymous> (/tmp/build_133f585dc02170b5c24a22d3bb3002bd/node_modules/node-bin-setup/index.js:18:27)
remote: at ChildProcess.emit (events.js:198:13)
remote: at maybeClose (internal/child_process.js:982:16)
remote: at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! node#12.4.0 preinstall: `node installArchSpecificPackage`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the node#12.4.0 preinstall 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.nPBvI/_logs/2019-06-25T15_20_23_924Z-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
I ended up deleting the node dependency I installed in my package.json and it worked like a charm. Thanks for the answers guys, hope this helps anyone else that runs into this.
Not sure if this is going to work but try adding this to your package.json:
"postinstall": "npm rebuild grpc --target=10.15.0 --target_arch=x64 --target_platform=linux --target_libc=glibc"
to the scripts element as such
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"postinstall": "npm rebuild grpc --target=10.15.0 --target_arch=x64 --target_platform=linux --target_libc=glibc"
}
and rebuild your project
Change the 'target' to your desired node version
I am pushing the react-node app to Heroku using Heroku CLI.
build is failing and the error is Could not find a required file index.html
I have checked all the files and everything in place
don't know what am I missing?
I am stuck here for one week.
Please help me
I am pushing the react-node app to Heroku using Heroku CLI.
build is failing and the error is Could not find a required file index.html
I have checked all the files and everything in place
don't know what am I missing?
I am stuck here for one week.
Please help me
Package.json
"main": "server.js",
"scripts": {
"start": "node server.js",
"server": "nodemon server.js",
"client": "npm start --prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\"",
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
},
Error :
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 398 bytes | 398.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 8.9.4
remote: engines.npm (package.json): 6.2.0
remote:
remote: Resolving node version 8.9.4...
remote: Downloading and installing node 8.9.4...
remote: Bootstrapping npm 6.2.0 (replacing 5.6.0)...
remote: npm 6.2.0 installed
remote:
remote: -----> Restoring cache
remote: - node_modules
remote:
remote: -----> Building dependencies
remote: Installing node modules (package.json)
remote: audited 2601 packages in 4.802s
remote: found 0 vulnerabilities
remote:
remote: Running heroku-postbuild
remote:
remote: > devconnector#1.0.0 heroku-postbuild /tmp/build_cb13714e30f186bd579e6f8f21bf9383
remote: > NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
remote:
remote:
remote: > jss#9.8.7 postinstall /tmp/build_cb13714e30f186bd579e6f8f21bf9383/client/node_modules/jss
remote: > node -e "console.log('\u001b[35m\u001b[1mLove JSS? You can now support us on open collective:\u001b[22m\u001b[39m\n > \u001b[34mhttps://opencollective.com/jss/donate\u001b[0m')"
remote:
remote: Love JSS? You can now support us on open collective:
remote: > https://opencollective.com/jss/donate
remote:
remote: > uglifyjs-webpack-plugin#0.4.6 postinstall /tmp/build_cb13714e30f186bd579e6f8f21bf9383/client/node_modules/uglifyjs-webpack-plugin
remote: > node lib/post_install.js
remote:
remote: added 1375 packages from 852 contributors and audited 13755 packages in 46.845s
remote: found 0 vulnerabilities
remote:
remote:
remote: > client#0.1.0 build /tmp/build_cb13714e30f186bd579e6f8f21bf9383/client
remote: > react-scripts build
remote:
**remote: Could not find a required file.
remote: Name: index.html**
remote: Searched in: /tmp/build_cb13714e30f186bd579e6f8f21bf9383/client/public
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! client#0.1.0 build: `react-scripts build`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the client#0.1.0 build scr`enter code here`ipt.
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.bspBQ/_logs/2018-10-14T10_57_59_194Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! devconnector#1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the devconnector#1.0.0 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.bspBQ/_logs/2018-10-14T10_57_59_208Z-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
remote: Verifying deploy...
remote:
remote: ! Push rejected to murmuring-depths-54253.
I also encountered this issue today and managed to fix it by removing /public folder from .gitignore.
Two things could be cause of this:
Probably you have /public directory specified inside your .gitignore
Case sensitive paths
more info at: https://create-react-app.dev/docs/deployment/#heroku
Possible Solution: Your file structure might be the issue
By chance do you have an 'api' folder next to your 'client' folder?
Heroku doesn't seem to play well with certain file structures (not sure why, I opened a ticket with them to inquire)
I was receiving almost the exact same error because I had most of my 'server' files within an api folder at the root.
After moving those files outside the api folder, removing my lock files, and reinstalling node modules, deployment went off without a hitch.
So, try the following:
Make sure that your file structure isn't conflicting with standard deployments (see screenshot below)
Remove your lock files and node_modules
Reinstall node_modules at root and in client
commit and and attempt another deploy -- let us know if that succeeds
As you can see, the only difference is the location of those folders within the api folder (obviously, import/require pathnames needed to be updated as well)
Failing Folder Structure
Successful Folder Structure