Closed shyjuonetikk closed 4 years ago
Hey, I've got the exact same problem. Has anyone solved this?
I am not sure if this is what the problem was, but since I did not have a git repository set up for this project when I started it, the create react app script added one to the client folder when it first created the app. I was able to fix this problem by removing the .git file from the client folder and then switching back to the main project folder and re initializing the repository.
https://facebook.github.io/create-react-app/docs/folder-structure
I think @sphred5 kind pointed it out - because the client folder generated by create-react-app command is actually a git submodule, the remote heroku master branch does not have the actual code (the package.json file).
It worked for me by removing .git dir in client and do git rm -f --cached client && git add . && git commit -m 'Add client folder back to git repo' && git push heroku master
.
I've got the same problem. There is no .git file or dir in my 'client' folder but just in case I run the command git rm -f --cached client && git add . && git commit -m 'Add client folder back to git repo' && git push heroku master
and still the same error.
@ginnie7 You can't easily see .git file. If you want to see it, go to client directory, enter subl .git , .git folder will be open in sublime.
So just simply enter rm -rf .git
from client directory.
Above solution worked well for me.
@RMCoder198 Thanks man now it worked
Thanks @Yongyiw The solution also worked for me
@shyjuonetikk if the solution works for you, please close the issue
Thank you, this solution works. can you explain what the git code does?
I think @sphred5 kind pointed it out - because the client folder generated by create-react-app command is actually a git submodule, the remote heroku master branch does not have the actual code (the package.json file).
It worked for me by removing .git dir in client and do
git rm -f --cached client && git add . && git commit -m 'Add client folder back to git repo' && git push heroku master
.
The code appears to be removing and re adding the client folder
I think @sphred5 kind pointed it out - because the client folder generated by create-react-app command is actually a git submodule, the remote heroku master branch does not have the actual code (the package.json file).
It worked for me by removing .git dir in client and do
git rm -f --cached client && git add . && git commit -m 'Add client folder back to git repo' && git push heroku master
.
OMG u saved my arse :). Been stuck with the .git file many time @@.
Once, tks a lot
Solved! Thank you all!
Solved. Thank You @Yongyiw
remote:
remote: npm ERR! path /tmp/build_a2b0989d0628d585076d5a80c56e4015/client/package.json
remote: npm ERR! code ENOENT
remote: npm ERR! errno -2
remote: npm ERR! syscall open
remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_a2b0989d0628d585076d5a80c56e4015/client/package.json'
remote: npm ERR! enoent This is related to npm not being able to find a file.
remote: npm ERR! enoent
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.nze42/_logs/2019-05-22T19_03_10_366Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 254
remote: npm ERR! mern_shoping_list@1.0.0 heroku-postbuild: NPM_CONFIG_PRODUCTION=false npm install --prefix-client && npm run build --prefix client
remote: npm ERR! Exit status 254
remote: npm ERR!
remote: npm ERR! Failed at the mern_shoping_list@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.nze42/_logs/2019-05-22T19_03_10_380Z-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: Some possible problems:
remote:
remote: - Node version not specified in package.json
remote: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
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 nameless-plains-35513.
remote:
To https://git.heroku.com/nameless-plains-35513.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/nameless-plains-35513.git'
@Kunalk651 In your package.json file specify the node version.
"engines": {
"node": "8.1.1",
"npm": "5.0.3"
},
Thanks, @PJijin but problem is still the same.
I suspect your problem lies here: npm install --prefix-client
Leave out the '-' between prefix and client: npm install --prefix client
i need help please .
remote: npm ERR! path /tmp/build_4ab4eaf09436bd702aa38c79db24be34/client/package.json
remote: npm ERR! code ENOENT
remote: npm ERR! errno -2
remote: npm ERR! syscall open
remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_4ab4eaf09436bd702aa38c79db24be34/client/package.json'
remote: npm ERR! enoent This is related to npm not being able to find a file.
remote: npm ERR! enoent
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.P3AmI/_logs/2019-06-06T07_30_54_038Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 254
remote: npm ERR! backend@1.0.0 heroku-postbuild: NPM_CONFIG_PRODUCTION=true npm install --prefix client && npm run build --prefix client
remote: npm ERR! Exit status 254
remote: npm ERR!
remote: npm ERR! Failed at the backend@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.P3AmI/_logs/2019-06-06T07_30_54_058Z-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:
In the video # 8; you see this:
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
and you've set the variable to true Could that be the cause?
Thanks @RMCoder198 . Your solution worked for me!
@RMCoder198 Thanks. Solved my problem!
You can also delete the .git folder from your file explorer if you have the show hidden files option checked, then run the bunch git rm -f --cached client git add . git commit -m "commit message" git push heroku master
HELP PLEASE!!! I GET THE FOLLOWING AFTER $git push heroku master
Enumerating objects: 3, done. Counting objects: 100% (3/3), done. Writing objects: 100% (3/3), 218 bytes | 218.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: ! No default language could be detected for this app. remote: HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically. remote: See https://devcenter.heroku.com/articles/buildpacks remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to mighty-tor-17423. remote: To https://git.heroku.com/mighty-tor-17423.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/mighty-tor-17423.git'
Thanks @ PJijin ! Your solution worked for me.
In my case, I added
"engines": { "node": "10.15.3", "npm": "6.4.1" },
under "description" in package.json file.
Also, this description by heroku helps to understand how to specify the version of node in package.json. https://devcenter.heroku.com/articles/deploying-nodejs
To check your version type,
node --version
npm -v
<3 work for me tooo
So I have been running into this issue where heroku doesnt deploy my app correctly, I did npm run build
, after that made a script for "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false && npm run build"
and even put "heroku-run-build-script": true
as for my server.js it is as follows
//server.js
const express = require('express');
const cors = require('cors');
const bodyParser = require('body-parser');
require('dotenv').config();
const PORT = process.env.PORT || 8080;
const app = express();
const handler = require('serve-handler');
const http = require('http');
const server = http.createServer((request, response) => {
// You pass two more arguments for config and middleware
// More details here: https://github.com/zeit/serve-handler#options
return handler(request, response);
})
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(cors());
app.use(express.json());
app.use(bodyParser.json()); // get information from html forms
if (process.env.NODE_ENV == 'production') {
// Exprees will serve up production assets
app.use(express.static(__dirname,'app/build'));
// Express serve up index.html file if it doesn't recognize route
const path = require('path');
app.get('/', (req, res) => {
res.sendFile(path.resolve(__dirname,'build/index.html'));
});
}
// Listen to whatever port above.
app.listen(PORT, () => {
console.log(`Our app is running on port ${PORT}`);
});
but i still get this request time out error
2019-10-30T00:46:47.095414+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=ministryofthesentinels.herokuapp.com request_id=80c91dbc-5d4d-48a3-85c3-75bf1fa54832 fwd="71.162.117.232" dyno=web.1 connect=0ms service=32ms status=200 bytes=60782 protocol=https
2019-10-30T00:49:55+00:00 app[api]: Build started by user ministryofthesentinels@gmail.com
2019-10-30T00:51:38.945815+00:00 app[api]: Deploy 77194229 by user ministryofthesentinels@gmail.com
2019-10-30T00:51:38.945815+00:00 app[api]: Release v47 created by user ministryofthesentinels@gmail.com
2019-10-30T00:51:39.435972+00:00 heroku[web.1]: Restarting
2019-10-30T00:51:39.454577+00:00 heroku[web.1]: State changed from up to starting
2019-10-30T00:51:40.423015+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2019-10-30T00:51:40.57467+00:00 heroku[web.1]: Process exited with status 143
2019-10-30T00:51:47+00:00 app[api]: Build succeeded
2019-10-30T00:51:54.917314+00:00 heroku[web.1]: Starting process with command `npm run dev`
2019-10-30T00:51:57.677236+00:00 app[web.1]:
2019-10-30T00:51:57.677265+00:00 app[web.1]: > TheInteractiveSeatSelectionApp@0.1.0 dev /app
2019-10-30T00:51:57.677276+00:00 app[web.1]: > concurrently "npm run server" "npm run client"
2019-10-30T00:51:57.677278+00:00 app[web.1]:
2019-10-30T00:51:58.727523+00:00 app[web.1]: [0]
2019-10-30T00:51:58.727547+00:00 app[web.1]: [0] > TheInteractiveSeatSelectionApp@0.1.0 server /app
2019-10-30T00:51:58.727551+00:00 app[web.1]: [0] > nodemon server.js
2019-10-30T00:51:58.727553+00:00 app[web.1]: [0]
2019-10-30T00:51:58.748668+00:00 app[web.1]: [1]
2019-10-30T00:51:58.748673+00:00 app[web.1]: [1] > TheInteractiveSeatSelectionApp@0.1.0 client /app
2019-10-30T00:51:58.748676+00:00 app[web.1]: [1] > react-scripts start --prefix src
2019-10-30T00:51:58.748678+00:00 app[web.1]: [1]
2019-10-30T00:51:59.148456+00:00 app[web.1]: [0] [nodemon] 1.19.4
2019-10-30T00:51:59.150237+00:00 app[web.1]: [0] [nodemon] to restart at any time, enter `rs`
2019-10-30T00:51:59.150946+00:00 app[web.1]: [0] [nodemon] watching dir(s): *.*
2019-10-30T00:51:59.151518+00:00 app[web.1]: [0] [nodemon] watching extensions: js,mjs,json
2019-10-30T00:51:59.151988+00:00 app[web.1]: [0] [nodemon] starting `node server.js`
2019-10-30T00:51:59.437719+00:00 app[web.1]: [0] /app/node_modules/serve-static/index.js:48
2019-10-30T00:51:59.437734+00:00 app[web.1]: [0] var opts = Object.create(options || null)
2019-10-30T00:51:59.437737+00:00 app[web.1]: [0] ^
2019-10-30T00:51:59.437739+00:00 app[web.1]: [0]
2019-10-30T00:51:59.437741+00:00 app[web.1]: [0] TypeError: Object prototype may only be an Object or null: app/build
2019-10-30T00:51:59.437744+00:00 app[web.1]: [0] at Function.create (<anonymous>)
2019-10-30T00:51:59.437747+00:00 app[web.1]: [0] at Function.serveStatic [as static] (/app/node_modules/serve-static/index.js:48:21)
2019-10-30T00:51:59.437749+00:00 app[web.1]: [0] at Object.<anonymous> (/app/server.js:30:19)
2019-10-30T00:51:59.437751+00:00 app[web.1]: [0] at Module._compile (internal/modules/cjs/loader.js:956:30)
2019-10-30T00:51:59.437753+00:00 app[web.1]: [0] at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
2019-10-30T00:51:59.437755+00:00 app[web.1]: [0] at Module.load (internal/modules/cjs/loader.js:812:32)
2019-10-30T00:51:59.437758+00:00 app[web.1]: [0] at Function.Module._load (internal/modules/cjs/loader.js:724:14)
2019-10-30T00:51:59.43776+00:00 app[web.1]: [0] at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
2019-10-30T00:51:59.437762+00:00 app[web.1]: [0] at internal/main/run_main_module.js:17:11
2019-10-30T00:51:59.447716+00:00 app[web.1]: [0] [nodemon] app crashed - waiting for file changes before starting...
2019-10-30T00:52:01.768262+00:00 app[web.1]: [1] Starting the development server...
2019-10-30T00:52:01.768287+00:00 app[web.1]: [1]
2019-10-30T00:52:02.168465+00:00 heroku[web.1]: State changed from starting to up
2019-10-30T00:52:34.253991+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=ministryofthesentinels.herokuapp.com request_id=c0432400-a60f-45b9-90ad-9657ad7a8008 fwd="71.162.117.232" dyno=web.1 connect=1ms service=30004ms status=503 bytes=0 protocol=https
2019-10-30T00:53:07.28402+00:00 app[web.1]: [1] Compiled successfully!
2019-10-30T00:53:07.284034+00:00 app[web.1]: [1]
2019-10-30T00:53:07.284037+00:00 app[web.1]: [1] You can now view TheInteractiveSeatSelectionApp in the browser.
2019-10-30T00:53:07.28404+00:00 app[web.1]: [1]
2019-10-30T00:53:07.284042+00:00 app[web.1]: [1] Local: http://localhost:43089/
2019-10-30T00:53:07.284063+00:00 app[web.1]: [1] On Your Network: http://172.18.196.226:43089/
2019-10-30T00:53:07.284066+00:00 app[web.1]: [1]
2019-10-30T00:53:07.284068+00:00 app[web.1]: [1] Note that the development build is not optimized.
2019-10-30T00:53:07.28407+00:00 app[web.1]: [1] To create a production build, use npm run build.
2019-10-30T00:53:07.284073+00:00 app[web.1]: [1]
2019-10-30T00:53:17+00:00 app[api]: Build started by user ministryofthesentinels@gmail.com
2019-10-30T00:54:54.243697+00:00 app[api]: Deploy fd80db40 by user ministryofthesentinels@gmail.com
2019-10-30T00:54:54.243697+00:00 app[api]: Release v48 created by user ministryofthesentinels@gmail.com
2019-10-30T00:54:54.79701+00:00 heroku[web.1]: Restarting
2019-10-30T00:54:54.815493+00:00 heroku[web.1]: State changed from up to starting
2019-10-30T00:54:55.847357+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2019-10-30T00:54:56.025647+00:00 heroku[web.1]: Process exited with status 143
2019-10-30T00:55:03+00:00 app[api]: Build succeeded
2019-10-30T00:55:13.267203+00:00 heroku[web.1]: Starting process with command `npm run dev`
2019-10-30T00:55:16.431396+00:00 app[web.1]:
2019-10-30T00:55:16.431454+00:00 app[web.1]: > TheInteractiveSeatSelectionApp@0.1.0 dev /app
2019-10-30T00:55:16.431462+00:00 app[web.1]: > concurrently "npm run server" "npm run client"
2019-10-30T00:55:16.431464+00:00 app[web.1]:
2019-10-30T00:55:17.720401+00:00 app[web.1]: [0]
2019-10-30T00:55:17.720434+00:00 app[web.1]: [0] > TheInteractiveSeatSelectionApp@0.1.0 server /app
2019-10-30T00:55:17.720437+00:00 app[web.1]: [0] > nodemon server.js
2019-10-30T00:55:17.720439+00:00 app[web.1]: [0]
2019-10-30T00:55:17.754533+00:00 app[web.1]: [1]
2019-10-30T00:55:17.754538+00:00 app[web.1]: [1] > TheInteractiveSeatSelectionApp@0.1.0 client /app
2019-10-30T00:55:17.75454+00:00 app[web.1]: [1] > react-scripts start --prefix src
2019-10-30T00:55:17.754542+00:00 app[web.1]: [1]
2019-10-30T00:55:18.377798+00:00 app[web.1]: [0] [nodemon] 1.19.4
2019-10-30T00:55:18.379659+00:00 app[web.1]: [0] [nodemon] to restart at any time, enter `rs`
2019-10-30T00:55:18.380866+00:00 app[web.1]: [0] [nodemon] watching dir(s): *.*
2019-10-30T00:55:18.381502+00:00 app[web.1]: [0] [nodemon] watching extensions: js,mjs,json
2019-10-30T00:55:18.383153+00:00 app[web.1]: [0] [nodemon] starting `node server.js`
2019-10-30T00:55:19.20335+00:00 app[web.1]: [0] /app/node_modules/serve-static/index.js:48
2019-10-30T00:55:19.203365+00:00 app[web.1]: [0] var opts = Object.create(options || null)
2019-10-30T00:55:19.203368+00:00 app[web.1]: [0] ^
2019-10-30T00:55:19.20337+00:00 app[web.1]: [0]
2019-10-30T00:55:19.203372+00:00 app[web.1]: [0] TypeError: Object prototype may only be an Object or null: app/build
2019-10-30T00:55:19.203374+00:00 app[web.1]: [0] at Function.create (<anonymous>)
2019-10-30T00:55:19.203377+00:00 app[web.1]: [0] at Function.serveStatic [as static] (/app/node_modules/serve-static/index.js:48:21)
2019-10-30T00:55:19.20338+00:00 app[web.1]: [0] at Object.<anonymous> (/app/server.js:30:19)
2019-10-30T00:55:19.203382+00:00 app[web.1]: [0] at Module._compile (internal/modules/cjs/loader.js:956:30)
2019-10-30T00:55:19.203384+00:00 app[web.1]: [0] at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
2019-10-30T00:55:19.203386+00:00 app[web.1]: [0] at Module.load (internal/modules/cjs/loader.js:812:32)
2019-10-30T00:55:19.203388+00:00 app[web.1]: [0] at Function.Module._load (internal/modules/cjs/loader.js:724:14)
2019-10-30T00:55:19.20339+00:00 app[web.1]: [0] at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
2019-10-30T00:55:19.203393+00:00 app[web.1]: [0] at internal/main/run_main_module.js:17:11
2019-10-30T00:55:19.493404+00:00 app[web.1]: [0] [nodemon] app crashed - waiting for file changes before starting...
2019-10-30T00:55:21.805105+00:00 heroku[web.1]: State changed from starting to up
2019-10-30T00:55:21.693832+00:00 app[web.1]: [1] Starting the development server...
2019-10-30T00:55:21.693847+00:00 app[web.1]: [1]
2019-10-30T00:55:52.225566+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=ministryofthesentinels.herokuapp.com request_id=293bcf3a-a6cc-48b2-a9cd-6ba43552f8f3 fwd="71.162.117.232" dyno=web.1 connect=1ms service=30005ms status=503 bytes=0 protocol=https
This is what my folder tree looks like
I tried everything still same error
` -----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries engines.node (package.json): 12.13.0 engines.npm (package.json): 6.12.0
Resolving node version 12.13.0...
Downloading and installing node 12.13.0...
npm 6.12.0 already installed with node
-----> Installing dependencies Installing node modules (package.json)
> node-cron@2.0.3 postinstall /tmp/build_9faa419bc726a4d5660a7378843ef2ed/node_modules/node-cron
> opencollective-postinstall
added 333 packages from 392 contributors and audited 623 packages in 14.218s
found 0 vulnerabilities
-----> Build Running heroku-postbuild
> student_finance@1.0.0 heroku-postbuild /tmp/build_9faa419bc726a4d5660a7378843ef2ed
> NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
up to date in 0.278s
found 0 vulnerabilities
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /tmp/build_9faa419bc726a4d5660a7378843ef2ed/client/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_9faa419bc726a4d5660a7378843ef2ed/client/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.3tMUQ/_logs/2019-11-07T02_00_55_809Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 254
npm ERR! student_finance@1.0.0 heroku-postbuild: NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
npm ERR! Exit status 254
npm ERR!
npm ERR! Failed at the student_finance@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.3tMUQ/_logs/2019-11-07T02_00_55_825Z-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
`
` -----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error NODE_ENV=production NODE_MODULES_CACHE=true NODE_VERBOSE=false
-----> Installing binaries engines.node (package.json): 12.13.0 engines.npm (package.json): 6.12.0
Resolving node version 12.13.0... Downloading and installing node 12.13.0... npm 6.12.0 already installed with node
-----> Installing dependencies Installing node modules (package.json)
> node-cron@2.0.3 postinstall /tmp/build_9faa419bc726a4d5660a7378843ef2ed/node_modules/node-cron > opencollective-postinstall added 333 packages from 392 contributors and audited 623 packages in 14.218s found 0 vulnerabilities
-----> Build Running heroku-postbuild
> student_finance@1.0.0 heroku-postbuild /tmp/build_9faa419bc726a4d5660a7378843ef2ed > NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client up to date in 0.278s found 0 vulnerabilities
npm ERR! code ENOENT npm ERR! syscall open npm ERR! path /tmp/build_9faa419bc726a4d5660a7378843ef2ed/client/package.json npm ERR! errno -2 npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_9faa419bc726a4d5660a7378843ef2ed/client/package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR! A complete log of this run can be found in: npm ERR! /tmp/npmcache.3tMUQ/_logs/2019-11-07T02_00_55_809Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 254 npm ERR! student_finance@1.0.0 heroku-postbuild:
NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
npm ERR! Exit status 254 npm ERR! npm ERR! Failed at the student_finance@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.3tMUQ/_logs/2019-11-07T02_00_55_825Z-debug.log -----> Build failedWe'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
`
hi @mehmoodchohan , have you found a solution to this problem I've spent the whole week trying to solve it.
Sometimes it helps to totally delete the node_modules folder, and to reinstall. Why? I don't know, but it helped me more than once.
Hi,
I'm about to publish a website using Heroku. I am following the instruction from your video and went to the instruction of heroku docs; however, there were errors upon publishing.
nodejs v12.14.0 heroku 7.35.1
Same issue, tried all of the above, ended up here. Would appreciate any advice. Thanks.
@stevenbowler
I already fixed the issue, The build failed because the App.css contains comments, issue occurred during the minification of css. Try to remove comments in App.css. also updating the heroku-postbuild to "heroku-postbuild": "npm install --prefix client && npm run build --prefix client".
You can check the logs here: https://devcenter.heroku.com/articles/logging
OK online now. Thanks Ethan0007.
remote: sh: 1: react-scripts: Permission denied
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 126
remote: npm ERR! client@0.1.0 build: react-scripts build
remote: npm ERR! Exit status 126
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.7HMbr/_logs/2020-01-18T19_40_17_188Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 126
remote: npm ERR! mern_shopping_list@1.0.0 heroku-postbuild: NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
remote: npm ERR! Exit status 126
remote: npm ERR!
remote: npm ERR! Failed at the mern_shopping_list@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.7HMbr/_logs/2020-01-18T19_40_17_201Z-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: Some possible problems:
remote:
remote: - node_modules checked into source control
remote: https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits
remote:
remote: Love,
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to shrouded-everglades-37878.
remote:
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/shrouded-everglades-37878.git'
I am getting the above error, still cannot seem to get it to work. Can anyone help?
I have tried the solutions suggested including deleting the .git folder from client but still no luck.
Someone else suggested to edit the permissions on Mongodb atlas, but there does not seem to be a security option for my cluster. Any help is much appreciated.
@timiland
Please try to use this command: npm install react-scripts --save also try to update your "heroku-postbuild": "npm install --prefix client && npm run build --prefix client". and try again.
@Ethan0007 Thanks man, worked a treat.
Is it normal for the project to show on chrome but not on safari?
I think @sphred5 kind pointed it out - because the client folder generated by create-react-app command is actually a git submodule, the remote heroku master branch does not have the actual code (the package.json file).
It worked for me by removing .git dir in client and do
git rm -f --cached client && git add . && git commit -m 'Add client folder back to git repo' && git push heroku master
.
this works perfectly fine.
Sorry when i success deploy then i tried in web browser then show cannot read property map of undefined
What can i do to resolve the problem?
Sorry, I am new in programming and I can't implement the @RMCoder198 's solution. Can someone explain how to do it in a detailed way?
RMCoder198's answer further explained: do you have a Terminal? Or the terminal window in Visual Studio Code?
Then you should go into the terminal, cd into the client folder / subdirectory, and then execute this command: rm -rf .git. This removes the .git folder completely. For better understanding, you should read documentation about the command line and how to work on the command line.
@kwibus2000 when i type "git rm -rf .git" in the terminar (inside client folder). I received this error: fatal: pathspec '.git' did not match any files. That seems that the file was deleted. After that return to the project folder and execute: git add . git commit -m 'Add client folder back to git repo' git push heroku master But i still having the same problem. Could you give me some advice for that? Thanks
@timiland
Please try to use this command: npm install react-scripts --save also try to update your "heroku-postbuild": "npm install --prefix client && npm run build --prefix client". and try again.
Hi @Ethan0007 , I tried to follow the above instructions (but still not working). Please help me :(
Here's my error deploy:
remote: npm ERR! code ENOENT
remote: npm ERR! syscall open
remote: npm ERR! path /tmp/build_837425c391593339476c269ca3f0721c/client/package.json
remote: npm ERR! errno -2
remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_837425c391593339476c269ca3f0721c/client/package.json'
remote: npm ERR! enoent This is related to npm not being able to find a file.
remote: npm ERR! enoent
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.UEsv8/_logs/2020-06-14T11_45_50_800Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 254
remote: npm ERR! backend@1.0.0 heroku-postbuild: npm install --prefix client && npm run build --prefix client
remote: npm ERR! Exit status 254
remote: npm ERR!
remote: npm ERR! Failed at the backend@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.UEsv8/_logs/2020-06-14T11_45_50_815Z-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: Some possible problems:
remote:
remote: - node_modules checked into source control
remote: https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits
remote:
remote: - Node version not specified in package.json
remote: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
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 safe-harbor-76397.
remote:
To https://git.heroku.com/safe-harbor-76397.git
! [remote rejected] master -> master (pre-receive hook declined)
After trying everything, this solution works for me: https://github.com/bradtraversy/mern_shopping_list/issues/42#issuecomment-636479324 @kimvillarmente, try with this solution.
After trying everything, this solution works for me: #42 (comment) @kimvillarmente, try with this solution.
@RedProyect thank you so much. It workss!!
I think @sphred5 kind pointed it out - because the client folder generated by create-react-app command is actually a git submodule, the remote heroku master branch does not have the actual code (the package.json file).
It worked for me by removing .git dir in client and do
git rm -f --cached client && git add . && git commit -m 'Add client folder back to git repo' && git push heroku master
.
So should the solution be doing git init as the first step in creating the project?
it got build successfully and hosted but heroku shows CANNOT GET/
Created app using this, and worked fine in localhost. While try to deploy to heroku it shows error.
remote: npm ERR! path /tmp/build_6a121e9cb8074af263e289230b4020cf/client/package.json remote: npm ERR! code ENOENT remote: npm ERR! errno -2 remote: npm ERR! syscall open remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_6a121e9cb8074af263e289230b4020cf/client/package.json' remote: npm ERR! enoent This is related to npm not being able to find a file. remote: npm ERR! enoent remote: remote: npm ERR! A complete log of this run can be found in: remote: npm ERR! /tmp/npmcache.ahlWT/_logs/2018-11-22T09_34_46_760Z-debug.log remote: npm ERR! code ELIFECYCLE remote: npm ERR! errno 254 remote: npm ERR! mern-shopping@1.0.0 heroku-postbuild:
NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
remote: npm ERR! Exit status 254 remote: npm ERR! remote: npm ERR! Failed at the mern-shopping@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.ahlWT/_logs/2018-11-22T09_34_46_776Z-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: Some possible problems: remote: remote: - node_modules checked into source control remote: https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits remote: remote: - Node version not specified in package.json remote: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version 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 enigmatic-refuge-71917. remote: To https://git.heroku.com/enigmatic-refuge-71917.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/enigmatic-refuge-71917.git'Please let me know how to figure this out.