I'm tried to upload a MERN stack project on heroku, when I push my project then does not show me any error, but after that when I tried to open my app then show me error like this:
Then when I see on heroku logs show me error like this:
2021-04-02T04:39:53.640765+00:00 app[web.1]: }
2021-04-02T04:39:53.673306+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-04-02T04:39:53.673901+00:00 app[web.1]: npm ERR! errno 1
2021-04-02T04:39:53.688128+00:00 app[web.1]: npm ERR! react-boiler-plate#1.0.0 start: `node server/index.js`
2021-04-02T04:39:53.688366+00:00 app[web.1]: npm ERR! Exit status 1
2021-04-02T04:39:53.688645+00:00 app[web.1]: npm ERR!
2021-04-02T04:39:53.688864+00:00 app[web.1]: npm ERR! Failed at the react-boiler-plate#1.0.0 start script.
2021-04-02T04:39:53.689072+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-04-02T04:39:53.702373+00:00 app[web.1]:
2021-04-02T04:39:53.702750+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-04-02T04:39:53.702956+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-04-02T04_39_53_691Z-debug.log
2021-04-02T04:39:53.801523+00:00 heroku[web.1]: Process exited with status 1
2021-04-02T04:39:57.606025+00:00 app[web.1]:
2021-04-02T04:39:57.606043+00:00 app[web.1]: > react-boiler-plate#1.0.0 start /app
2021-04-02T04:39:57.606044+00:00 app[web.1]: > node server/index.js
2021-04-02T04:39:57.606044+00:00 app[web.1]:
2021-04-02T04:39:59.617643+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
2021-04-02T04:39:59.617704+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2021-04-02T04:39:59.618588+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
2021-04-02T04:39:59.618717+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
2021-04-02T04:39:59.618853+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
2021-04-02T04:39:59.619452+00:00 app[web.1]: Server Listening on 52400
2021-04-02T04:39:59.664202+00:00 heroku[web.1]: State changed from starting to up
2021-04-02T04:40:00.154607+00:00 app[web.1]: MongoDB Connected...
2021-04-02T04:40:02.562719+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=482fc0ad-4dbf-4d68-a0b8-4ad915f0356d fwd="116.58.200.211" dyno=web.1 connect=0ms service=81ms status=404 bytes=412 protocol=https
2021-04-02T04:40:02.564414+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:40:12.580732+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=0cb0a90a-eefe-4730-97f2-58ad7601fb31 fwd="116.58.200.211" dyno=web.1 connect=0ms service=11ms status=404 bytes=412 protocol=https
2021-04-02T04:40:12.581974+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:41:07.703010+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=5195792b-17a0-4044-82a6-8e392f3bc920 fwd="116.58.200.211" dyno=web.1 connect=0ms service=13ms status=404 bytes=412 protocol=https
2021-04-02T04:41:07.703565+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:43:56.612829+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:43:56.614507+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=24d996e4-a43f-427c-89d5-a83fad29ec8e fwd="116.58.200.211" dyno=web.1 connect=2ms service=15ms status=404 bytes=412 protocol=https
2021-04-02T04:47:24.095734+00:00 app[api]: Set NODE_ENV config vars by user alaminsheikh30025#gmail.com
2021-04-02T04:47:24.095734+00:00 app[api]: Release v7 created by user alaminsheikh30025#gmail.com
2021-04-02T04:47:24.300332+00:00 heroku[web.1]: Restarting
2021-04-02T04:47:24.302570+00:00 heroku[web.1]: State changed from up to starting
2021-04-02T04:47:26.081387+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-04-02T04:47:26.273408+00:00 heroku[web.1]: Process exited with status 143
2021-04-02T04:47:28.480334+00:00 heroku[web.1]: Starting process with command `npm start`
2021-04-02T04:47:32.050957+00:00 app[web.1]:
2021-04-02T04:47:32.050999+00:00 app[web.1]: > react-boiler-plate#1.0.0 start /app
2021-04-02T04:47:32.051000+00:00 app[web.1]: > node server/index.js
2021-04-02T04:47:32.051001+00:00 app[web.1]:
2021-04-02T04:47:33.084385+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
2021-04-02T04:47:33.084397+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2021-04-02T04:47:33.085117+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
2021-04-02T04:47:33.085232+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
2021-04-02T04:47:33.085334+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
2021-04-02T04:47:33.085964+00:00 app[web.1]: Server Listening on 8465
2021-04-02T04:47:33.331113+00:00 app[web.1]: MongoDB Connected...
2021-04-02T04:47:33.388190+00:00 heroku[web.1]: State changed from starting to up
2021-04-02T04:47:34.346673+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=183fcfe3-db55-4a00-b385-9d7d66f60ed4 fwd="116.58.200.211" dyno=web.1 connect=1ms service=24ms status=404 bytes=412 protocol=https
2021-04-02T04:47:34.348398+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:48:45.968962+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=2a1df37e-9697-4cf4-be41-cc907f6cb724 fwd="116.58.200.211" dyno=web.1 connect=0ms service=16ms status=404 bytes=412 protocol=https
2021-04-02T04:48:45.969496+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:55:29.405371+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T04:55:29.405889+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=b9b8b037-8c4a-4c58-9fc9-d116af2283e9 fwd="116.58.200.211" dyno=web.1 connect=0ms service=10ms status=404 bytes=412 protocol=https
2021-04-02T05:02:01.000000+00:00 app[api]: Build started by user alaminsheikh30025#gmail.com
2021-04-02T05:02:35.128829+00:00 app[api]: Deploy 7dd2269f by user alaminsheikh30025#gmail.com
2021-04-02T05:02:35.128829+00:00 app[api]: Release v8 created by user alaminsheikh30025#gmail.com
2021-04-02T05:02:35.313075+00:00 heroku[web.1]: Restarting
2021-04-02T05:02:35.315983+00:00 heroku[web.1]: State changed from up to starting
2021-04-02T05:02:36.000000+00:00 app[api]: Build succeeded
2021-04-02T05:02:36.713360+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-04-02T05:02:36.983404+00:00 heroku[web.1]: Process exited with status 143
2021-04-02T05:02:39.085257+00:00 heroku[web.1]: Starting process with command `npm start`
2021-04-02T05:02:42.325482+00:00 app[web.1]:
2021-04-02T05:02:42.326048+00:00 app[web.1]: > react-boiler-plate#1.0.0 start /app
2021-04-02T05:02:42.326051+00:00 app[web.1]: > node server/index.js
2021-04-02T05:02:42.326053+00:00 app[web.1]:
2021-04-02T05:02:43.565518+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
2021-04-02T05:02:43.565529+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2021-04-02T05:02:43.566549+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
2021-04-02T05:02:43.566660+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
2021-04-02T05:02:43.566774+00:00 app[web.1]: (node:21) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
2021-04-02T05:02:43.567285+00:00 app[web.1]: Server Listening on 58335
2021-04-02T05:02:43.757613+00:00 app[web.1]: MongoDB Connected...
2021-04-02T05:02:43.923407+00:00 heroku[web.1]: State changed from starting to up
2021-04-02T05:03:06.224704+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=0dfe3e56-29e2-4abd-9326-30f22a3f3a3f fwd="116.58.200.211" dyno=web.1 connect=3ms service=24ms status=404 bytes=412 protocol=https
2021-04-02T05:03:06.226724+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
2021-04-02T05:37:05.548583+00:00 heroku[web.1]: Idling
2021-04-02T05:37:05.550224+00:00 heroku[web.1]: State changed from up to down
2021-04-02T05:37:06.905027+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-04-02T05:37:07.188301+00:00 heroku[web.1]: Process exited with status 143
2021-04-02T05:45:52.000000+00:00 app[api]: Build started by user alaminsheikh30025#gmail.com
2021-04-02T05:46:24.941298+00:00 app[api]: Deploy 3d2e9eec by user alaminsheikh30025#gmail.com
2021-04-02T05:46:24.941298+00:00 app[api]: Release v9 created by user alaminsheikh30025#gmail.com
2021-04-02T05:46:25.895329+00:00 heroku[web.1]: State changed from down to starting
2021-04-02T05:46:26.000000+00:00 app[api]: Build succeeded
2021-04-02T05:46:29.859262+00:00 heroku[web.1]: Starting process with command `node index.js`
2021-04-02T05:46:33.688119+00:00 app[web.1]: (node:4) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
2021-04-02T05:46:33.688136+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2021-04-02T05:46:33.688805+00:00 app[web.1]: (node:4) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
2021-04-02T05:46:33.688950+00:00 app[web.1]: (node:4) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
2021-04-02T05:46:33.689117+00:00 app[web.1]: (node:4) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
2021-04-02T05:46:33.689750+00:00 app[web.1]: Server Listening on 3542
2021-04-02T05:46:33.946525+00:00 app[web.1]: MongoDB Connected...
2021-04-02T05:46:34.274995+00:00 heroku[web.1]: State changed from starting to up
2021-04-02T05:46:41.770270+00:00 heroku[router]: at=info method=GET path="/" host=portfolio-show.herokuapp.com request_id=c42834c5-a16c-4c12-ab34-41f2a229d0d6 fwd="116.58.200.211" dyno=web.1 connect=0ms service=48ms status=404 bytes=412 protocol=https
2021-04-02T05:46:41.775861+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
I have config file by this way:
.dev.js file:
module.exports = {
mongoURI:
"mongodb+srv://username:pass#demo.erwyk.mongodb.net/PORTFOLIO?retryWrites=true&w=majority",
};
prod.js file:
module.exports = {
mongoURI: process.env.MONGO_URI,
};
key.js file:
if (process.env.NODE_ENV === 'production') {
module.exports = require('./prod');
} else {
module.exports = require('./dev');
}
then I have add config file on heroku:
Any Suggestion Please.
Actually I was problem on project config, I have solved by this way:
Make configuration for heroku deployment
specify npm and node version for frontend deployment.[check version npm -v and node -v]
Then npm run build for client folder
Put environment variable for production mode in heroku website [for me MONGO_URI]
then go to server folder inside package.js
add this line of code
script {
....
"heroku-postbuild": "NPM_PRODUCTION:false npm install --prefix client && npm run build --prefix client"
}
That's it.
then go to terminal...
heroku login
git init
git add .
git commit -m "bug fixed"
heroku git:remote -a <app_name> (if already created a app in heroku, otherwise heroku create)
git push heroku master
heroku open
Hope app will run successfully,
Thank you, [if still faced any problem then let me know in the comment section]
Related
i pushed my mern stack project to heroku master for deployement after opening the app its showing not found. spent so many hours and refered related stackoverflow questions nothing fixed my issue
i build my project using
"scripts": {
"build": "cd backend && npm install && cd ../frontend && npm install && npm run build",
"start": "node backend/server.js",
}
inside terminal i build my project using npm run build build successfully
server.js
app.use(express.static(path.join(__dirname, '/frontend/build')));
app.get('*', (req,res) => {
res.sendFile(path.join(__dirname, '/frontend/build/index.html'))
})
and here is my folder structure
files inside build folder
pushing files to heroku master return successfull with no errors.
loging heroku logs --tail gives this below
2022-11-08T06:05:01.882420+00:00 heroku[web.1]: State changed from crashed to starting
2022-11-08T06:05:09.142138+00:00 heroku[web.1]: Starting process with command `npm start`
2022-11-08T06:05:11.262904+00:00 app[web.1]:
2022-11-08T06:05:11.262931+00:00 app[web.1]: > blog-app#1.0.0 start
2022-11-08T06:05:11.262932+00:00 app[web.1]: > node backend/server.js
2022-11-08T06:05:11.262932+00:00 app[web.1]:
2022-11-08T06:05:11.880253+00:00 app[web.1]: server connected on port http://localhost:52809
2022-11-08T06:05:12.097847+00:00 heroku[web.1]: State changed from starting to up
2022-11-08T06:05:13.711620+00:00 app[web.1]: server connected to mongoDB
2022-11-08T06:05:23.749281+00:00 heroku[router]: at=info method=GET path="/" host=thekrishblog.herokuapp.com request_id=f8b42c26-5f03-46e5-a04e-0fa6cb14d8b8 fwd="117.204.133.112" dyno=web.1 connect=0ms service=7ms status=404 bytes=380 protocol=https
2022-11-08T06:05:23.750032+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/backend/frontend/build/index.html'
2022-11-08T06:06:26.010343+00:00 heroku[router]: at=info method=GET path="/" host=thekrishblog.herokuapp.com request_id=18800012-c573-49aa-a6f8-b107f95a3013 fwd="117.204.133.112" dyno=web.1 connect=0ms service=2ms status=404 bytes=380 protocol=https
2022-11-08T06:06:26.008479+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/backend/frontend/build/index.html'
also refered Heroku ENOENT: no such file or directory, stat '/app/build/index.html' but it dosent answered my problem
Hello I am deploying for the first time with heroku, and I have a problem.
When doing git push heroku master everything works correctly, but when entering the site through the browser it shows me only the message of Method Not Allowed
About the project: It is made with nodejs, express, postgres and sequelize on the backend side and with react on the front side.
The database is already uploaded and is working correctly! but when uploading the project it doesn't work
when doing heroku logs -n 200 it returns me
› Warning: heroku update available from 7.59.1 to 7.59.2.
2021-12-28T00:46:51.552641+00:00 app[api]: Initial release by user ivanleodomin00#gmail.com
2021-12-28T00:46:51.552641+00:00 app[api]: Release v1 created by user ivanleodomin00#gmail.com
2021-12-28T00:46:55.112224+00:00 app[api]: Release v2 created by user ivanleodomin00#gmail.com
2021-12-28T00:46:55.112224+00:00 app[api]: Enable Logplex by user ivanleodomin00#gmail.com
2021-12-28T00:47:57.250526+00:00 app[api]: Attach DATABASE (#ref:postgresql-amorphous-18095) by user ivanleodomin00#gmail.com
2021-12-28T00:47:57.250526+00:00 app[api]: Running release v3 commands by user ivanleodomin00#gmail.com
2021-12-28T00:47:57.275444+00:00 app[api]: #ref:postgresql-amorphous-18095 completed provisioning, setting DATABASE_URL. by user ivanleodomin00#gmail.com
2021-12-28T00:47:57.275444+00:00 app[api]: Release v4 created by user ivanleodomin00#gmail.com
2021-12-28T01:10:18.000000+00:00 app[api]: Build started by user ivanleodomin00#gmail.com
2021-12-28T01:10:38.372557+00:00 app[api]: Deploy abd73b84 by user ivanleodomin00#gmail.com
2021-12-28T01:10:38.372557+00:00 app[api]: Release v5 created by user ivanleodomin00#gmail.com
2021-12-28T01:10:38.387597+00:00 app[api]: Scaled to web#1:Free by user ivanleodomin00#gmail.com
2021-12-28T01:10:39.000000+00:00 app[api]: Build succeeded
2021-12-28T01:10:41.897243+00:00 heroku[web.1]: Starting process with command `npm start`
2021-12-28T01:10:43.543463+00:00 app[web.1]:
2021-12-28T01:10:43.543478+00:00 app[web.1]: > e-commerce#0.1.0 start /app
2021-12-28T01:10:43.543478+00:00 app[web.1]: > per-env
2021-12-28T01:10:43.543478+00:00 app[web.1]:
2021-12-28T01:10:43.561920+00:00 app[web.1]: sh: 1: per-env: not found
2021-12-28T01:10:43.568721+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-12-28T01:10:43.568931+00:00 app[web.1]: npm ERR! syscall spawn
2021-12-28T01:10:43.569020+00:00 app[web.1]: npm ERR! file sh
2021-12-28T01:10:43.569124+00:00 app[web.1]: npm ERR! errno ENOENT
2021-12-28T01:10:43.573632+00:00 app[web.1]: npm ERR! e-commerce#0.1.0 start: `per-env`
2021-12-28T01:10:43.573685+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-12-28T01:10:43.573770+00:00 app[web.1]: npm ERR!
2021-12-28T01:10:43.573839+00:00 app[web.1]: npm ERR! Failed at the e-commerce#0.1.0 start script.
2021-12-28T01:10:43.573890+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-12-28T01:10:43.579537+00:00 app[web.1]:
2021-12-28T01:10:43.579638+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-12-28T01:10:43.579689+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-12-28T01_10_43_574Z-debug.log
2021-12-28T01:10:43.703276+00:00 heroku[web.1]: Process exited with status 1
2021-12-28T01:10:43.758598+00:00 heroku[web.1]: State changed from starting to crashed
2021-12-28T01:10:43.763138+00:00 heroku[web.1]: State changed from crashed to starting
2021-12-28T01:10:46.370206+00:00 heroku[web.1]: Starting process with command `npm start`
2021-12-28T01:10:47.472121+00:00 app[web.1]:
2021-12-28T01:10:47.472132+00:00 app[web.1]: > e-commerce#0.1.0 start /app
2021-12-28T01:10:47.472132+00:00 app[web.1]: > per-env
2021-12-28T01:10:47.472132+00:00 app[web.1]:
2021-12-28T01:10:47.476034+00:00 app[web.1]: sh: 1: per-env: not found
2021-12-28T01:10:47.479992+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-12-28T01:10:47.480158+00:00 app[web.1]: npm ERR! syscall spawn
2021-12-28T01:10:47.480221+00:00 app[web.1]: npm ERR! file sh
2021-12-28T01:10:47.480286+00:00 app[web.1]: npm ERR! errno ENOENT
2021-12-28T01:10:47.482318+00:00 app[web.1]: npm ERR! e-commerce#0.1.0 start: `per-env`
2021-12-28T01:10:47.482361+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-12-28T01:10:47.482406+00:00 app[web.1]: npm ERR!
2021-12-28T01:10:47.482446+00:00 app[web.1]: npm ERR! Failed at the e-commerce#0.1.0 start script.
2021-12-28T01:10:47.482482+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-12-28T01:10:47.486127+00:00 app[web.1]:
2021-12-28T01:10:47.486197+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-12-28T01:10:47.486228+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-12-28T01_10_47_483Z-debug.log
2021-12-28T01:10:47.615077+00:00 heroku[web.1]: Process exited with status 1
2021-12-28T01:10:47.682401+00:00 heroku[web.1]: State changed from starting to crashed
2021-12-28T01:19:01.000000+00:00 app[api]: Build started by user ivanleodomin00#gmail.com
2021-12-28T01:19:21.617612+00:00 app[api]: Deploy 481231e4 by user ivanleodomin00#gmail.com
2021-12-28T01:19:21.617612+00:00 app[api]: Release v6 created by user ivanleodomin00#gmail.com
2021-12-28T01:19:22.000000+00:00 app[api]: Build succeeded
2021-12-28T01:19:22.754313+00:00 heroku[web.1]: State changed from crashed to starting
2021-12-28T01:19:25.218296+00:00 heroku[web.1]: Starting process with command `npm start`
2021-12-28T01:19:26.154715+00:00 app[web.1]:
2021-12-28T01:19:26.154724+00:00 app[web.1]: > e-commerce#0.1.0 start /app
2021-12-28T01:19:26.154724+00:00 app[web.1]: > npm run server
2021-12-28T01:19:26.154725+00:00 app[web.1]:
2021-12-28T01:19:26.358957+00:00 app[web.1]:
2021-12-28T01:19:26.358959+00:00 app[web.1]: > e-commerce#0.1.0 server /app
2021-12-28T01:19:26.358959+00:00 app[web.1]: > nodemon server.js
2021-12-28T01:19:26.358960+00:00 app[web.1]:
2021-12-28T01:19:26.363664+00:00 app[web.1]: sh: 1: nodemon: not found
2021-12-28T01:19:26.367517+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-12-28T01:19:26.367670+00:00 app[web.1]: npm ERR! syscall spawn
2021-12-28T01:19:26.367739+00:00 app[web.1]: npm ERR! file sh
2021-12-28T01:19:26.367822+00:00 app[web.1]: npm ERR! errno ENOENT
2021-12-28T01:19:26.370782+00:00 app[web.1]: npm ERR! e-commerce#0.1.0 server: `nodemon server.js`
2021-12-28T01:19:26.370823+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-12-28T01:19:26.370876+00:00 app[web.1]: npm ERR!
2021-12-28T01:19:26.370924+00:00 app[web.1]: npm ERR! Failed at the e-commerce#0.1.0 server script.
2021-12-28T01:19:26.370966+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-12-28T01:19:26.373409+00:00 app[web.1]:
2021-12-28T01:19:26.373479+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-12-28T01:19:26.373515+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-12-28T01_19_26_371Z-debug.log
2021-12-28T01:19:26.381218+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-12-28T01:19:26.381440+00:00 app[web.1]: npm ERR! errno 1
2021-12-28T01:19:26.385033+00:00 app[web.1]: npm ERR! e-commerce#0.1.0 start: `npm run server`
2021-12-28T01:19:26.385078+00:00 app[web.1]: npm ERR! Exit status 1
2021-12-28T01:19:26.385133+00:00 app[web.1]: npm ERR!
2021-12-28T01:19:26.385190+00:00 app[web.1]: npm ERR! Failed at the e-commerce#0.1.0 start script.
2021-12-28T01:19:26.385249+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-12-28T01:19:26.388004+00:00 app[web.1]:
2021-12-28T01:19:26.388101+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-12-28T01:19:26.388128+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-12-28T01_19_26_385Z-debug.log
2021-12-28T01:19:26.532464+00:00 heroku[web.1]: Process exited with status 1
2021-12-28T01:19:26.580646+00:00 heroku[web.1]: State changed from starting to crashed
2021-12-28T02:10:34.000000+00:00 app[api]: Build started by user ivanleodomin00#gmail.com
2021-12-28T02:10:55.246466+00:00 app[api]: Release v7 created by user ivanleodomin00#gmail.com
2021-12-28T02:10:55.246466+00:00 app[api]: Deploy 408cc0e7 by user ivanleodomin00#gmail.com
2021-12-28T02:10:56.000000+00:00 app[api]: Build succeeded
2021-12-28T02:10:56.665889+00:00 heroku[web.1]: State changed from crashed to starting
2021-12-28T02:10:59.192072+00:00 heroku[web.1]: Starting process with command `npm start`
2021-12-28T02:11:00.408464+00:00 app[web.1]:
2021-12-28T02:11:00.408486+00:00 app[web.1]: > e-commerce#0.1.0 start /app
2021-12-28T02:11:00.408486+00:00 app[web.1]: > node server.js
2021-12-28T02:11:00.408486+00:00 app[web.1]:
2021-12-28T02:11:00.924625+00:00 app[web.1]: Tue, 28 Dec 2021 02:11:00 GMT express-session deprecated undefined resave option; provide resave option at server.js:19:9
2021-12-28T02:11:00.925307+00:00 app[web.1]: Tue, 28 Dec 2021 02:11:00 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at server.js:19:9
2021-12-28T02:11:00.925975+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2021-12-28T02:11:00.925976+00:00 app[web.1]: designed for a production environment, as it will leak
2021-12-28T02:11:00.925976+00:00 app[web.1]: memory, and will not scale past a single process.
2021-12-28T02:11:01.052123+00:00 app[web.1]: listen on port 4747
2021-12-28T02:11:59.280273+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2021-12-28T02:11:59.310519+00:00 heroku[web.1]: Stopping process with SIGKILL
2021-12-28T02:11:59.457957+00:00 heroku[web.1]: Process exited with status 137
2021-12-28T02:11:59.513246+00:00 heroku[web.1]: State changed from starting to crashed
2021-12-28T02:11:59.517764+00:00 heroku[web.1]: State changed from crashed to starting
2021-12-28T02:12:01.776449+00:00 heroku[web.1]: Starting process with command `npm start`
2021-12-28T02:12:02.697087+00:00 app[web.1]:
2021-12-28T02:12:02.697102+00:00 app[web.1]: > e-commerce#0.1.0 start /app
2021-12-28T02:12:02.697102+00:00 app[web.1]: > node server.js
2021-12-28T02:12:02.697103+00:00 app[web.1]:
2021-12-28T02:12:03.109575+00:00 app[web.1]: Tue, 28 Dec 2021 02:12:03 GMT express-session deprecated undefined resave option; provide resave option at server.js:19:9
2021-12-28T02:12:03.109947+00:00 app[web.1]: Tue, 28 Dec 2021 02:12:03 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at server.js:19:9
2021-12-28T02:12:03.110335+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2021-12-28T02:12:03.110336+00:00 app[web.1]: designed for a production environment, as it will leak
2021-12-28T02:12:03.110336+00:00 app[web.1]: memory, and will not scale past a single process.
2021-12-28T02:12:03.270410+00:00 app[web.1]: listen on port 4747
2021-12-28T02:13:02.321588+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2021-12-28T02:13:02.385589+00:00 heroku[web.1]: Stopping process with SIGKILL
2021-12-28T02:13:02.423619+00:00 app[web.1]: Error waiting for process to terminate: No child processes
2021-12-28T02:13:02.555802+00:00 heroku[web.1]: Process exited with status 22
2021-12-28T02:13:02.619496+00:00 heroku[web.1]: State changed from starting to crashed
2021-12-28T02:24:06.811349+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=devmusic-e.herokuapp.com request_id=b963cdda-25f1-40ad-ad48-453d230fd1d0 fwd="181.165.54.184" dyno= connect= service= status=503 bytes= protocol=https
2021-12-28T02:24:07.567128+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=devmusic-e.herokuapp.com request_id=e4181dab-522f-4d25-8cf7-571e2f47abb2 fwd="181.165.54.184" dyno= connect= service= status=503 bytes= protocol=https
2021-12-28T02:27:20.713535+00:00 app[api]: Starting process with command `rails console` by user ivanleodomin00#gmail.com
2021-12-28T02:27:23.597696+00:00 heroku[run.8831]: Awaiting client
2021-12-28T02:27:23.612526+00:00 heroku[run.8831]: Starting process with command `rails console`
2021-12-28T02:27:23.768779+00:00 heroku[run.8831]: State changed from starting to up
2021-12-28T02:27:26.931258+00:00 heroku[run.8831]: Process exited with status 127
2021-12-28T02:27:26.991577+00:00 heroku[run.8831]: State changed from up to complete
2021-12-28T02:27:32.365105+00:00 app[api]: Starting process with command `rails console` by user ivanleodomin00#gmail.com
2021-12-28T02:27:35.374067+00:00 heroku[run.9154]: Awaiting client
2021-12-28T02:27:35.382164+00:00 heroku[run.9154]: State changed from starting to up
2021-12-28T02:27:35.392551+00:00 heroku[run.9154]: Starting process with command `rails console`
2021-12-28T02:27:38.713398+00:00 heroku[run.9154]: Process exited with status 127
2021-12-28T02:27:38.759105+00:00 heroku[run.9154]: State changed from up to complete
2021-12-28T02:30:02.434663+00:00 app[api]: Starting process with command `rails console` by user ivanleodomin00#gmail.com
2021-12-28T02:30:05.749584+00:00 heroku[run.5828]: Awaiting client
2021-12-28T02:30:05.759879+00:00 heroku[run.5828]: State changed from starting to up
2021-12-28T02:30:05.766832+00:00 heroku[run.5828]: Starting process with command `rails console`
2021-12-28T02:30:09.092845+00:00 heroku[run.5828]: Process exited with status 127
2021-12-28T02:30:09.145510+00:00 heroku[run.5828]: State changed from up to complete
2021-12-28T02:33:06.079727+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=devmusic-e.herokuapp.com request_id=49e83d77-278f-470d-9f6b-fa7706e1584c fwd="181.165.54.184" dyno= connect= service= status=503 bytes= protocol=https
2021-12-28T02:33:06.764438+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=devmusic-e.herokuapp.com request_id=3b4a6dac-235a-4a9f-b6e5-0a29ff44616e fwd="181.165.54.184" dyno= connect= service= status=503 bytes= protocol=https
I have created an app that upload some files and than send me object like that
{"name":"MEHMET SAYIN CV - 10_2021.pdf","type":"application/pdf","size":99771}
I used multer to handle uploading files. When I upload it to heroku I failed.I want to share the logs related.
2021-10-15T15:51:02.457409+00:00 app[api]: Deploy 6e984f86 by user sayinmehmet47#gmail.com
2021-10-15T15:51:02.457409+00:00 app[api]: Release v11 created by user sayinmehmet47#gmail.com
2021-10-15T15:51:03.599539+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-15T15:51:05.000000+00:00 app[api]: Build succeeded
2021-10-15T15:51:05.698098+00:00 heroku[web.1]: Starting process with command `npm start`
2021-10-15T15:51:06.737506+00:00 app[web.1]:
2021-10-15T15:51:06.737526+00:00 app[web.1]: > file_metadata#0.0.1 start /app
2021-10-15T15:51:06.737527+00:00 app[web.1]: > node server.js
2021-10-15T15:51:06.737527+00:00 app[web.1]:
2021-10-15T15:51:07.036041+00:00 app[web.1]: connected
2021-10-15T15:51:07.068246+00:00 app[web.1]: /app/node_modules/mkdirp/index.js:91
2021-10-15T15:51:07.068247+00:00 app[web.1]: throw err0;
2021-10-15T15:51:07.068248+00:00 app[web.1]: ^
2021-10-15T15:51:07.068248+00:00 app[web.1]:
2021-10-15T15:51:07.068248+00:00 app[web.1]: Error: EROFS: read-only file system, mkdir '/public'
2021-10-15T15:51:07.068249+00:00 app[web.1]: at Object.mkdirSync (fs.js:1013:3)
2021-10-15T15:51:07.068249+00:00 app[web.1]: at sync (/app/node_modules/mkdirp/index.js:72:13)
2021-10-15T15:51:07.068250+00:00 app[web.1]: at sync (/app/node_modules/mkdirp/index.js:78:24)
2021-10-15T15:51:07.068250+00:00 app[web.1]: at Function.sync (/app/node_modules/mkdirp/index.js:78:24)
2021-10-15T15:51:07.068250+00:00 app[web.1]: at new DiskStorage (/app/node_modules/multer/storage/disk.js:21:12)
2021-10-15T15:51:07.068251+00:00 app[web.1]: at module.exports (/app/node_modules/multer/storage/disk.js:65:10)
2021-10-15T15:51:07.068251+00:00 app[web.1]: at new Multer (/app/node_modules/multer/index.js:15:20)
2021-10-15T15:51:07.068252+00:00 app[web.1]: at multer (/app/node_modules/multer/index.js:95:12)
2021-10-15T15:51:07.068252+00:00 app[web.1]: at Object.<anonymous> (/app/api/files.js:4:16)
2021-10-15T15:51:07.068252+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1085:14) {
2021-10-15T15:51:07.068253+00:00 app[web.1]: errno: -30,
2021-10-15T15:51:07.068253+00:00 app[web.1]: syscall: 'mkdir',
2021-10-15T15:51:07.068253+00:00 app[web.1]: code: 'EROFS',
2021-10-15T15:51:07.068254+00:00 app[web.1]: path: '/public'
2021-10-15T15:51:07.068254+00:00 app[web.1]: }
2021-10-15T15:51:07.079497+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-10-15T15:51:07.079732+00:00 app[web.1]: npm ERR! errno 1
2021-10-15T15:51:07.083831+00:00 app[web.1]: npm ERR! file_metadata#0.0.1 start: `node server.js`
2021-10-15T15:51:07.083871+00:00 app[web.1]: npm ERR! Exit status 1
2021-10-15T15:51:07.083924+00:00 app[web.1]: npm ERR!
2021-10-15T15:51:07.083988+00:00 app[web.1]: npm ERR! Failed at the file_metadata#0.0.1 start script.
2021-10-15T15:51:07.083989+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-10-15T15:51:07.089384+00:00 app[web.1]:
2021-10-15T15:51:07.089446+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-10-15T15:51:07.089472+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-10-15T15_51_07_084Z-debug.log
2021-10-15T15:51:07.196350+00:00 heroku[web.1]: Process exited with status 1
2021-10-15T15:51:07.347289+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-15T15:51:12.784398+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=filedownl12.herokuapp.com request_id=fe098106-1546-4b7c-9b8c-fefe790dfae7 fwd="77.49.34.161" dyno= connect= service= status=503 bytes= protocol=https
2021-10-15T15:51:13.747221+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=filedownl12.herokuapp.com request_id=8173d073-97c1-45e1-afab-c3b2da397e12 fwd="77.49.34.161" dyno= connect= service= status=503 bytes= protocol=https
2021-10-15T16:04:45.000000+00:00 app[api]: Build started by user sayinmehmet47#gmail.com
2021-10-15T16:05:21.465576+00:00 app[api]: Deploy 1f51e389 by user sayinmehmet47#gmail.com
2021-10-15T16:05:21.465576+00:00 app[api]: Release v12 created by user sayinmehmet47#gmail.com
2021-10-15T16:05:23.278268+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-15T16:05:24.000000+00:00 app[api]: Build succeeded
2021-10-15T16:05:26.141343+00:00 heroku[web.1]: Starting process with command `node ./server.js`
2021-10-15T16:05:27.754473+00:00 app[web.1]: connected
2021-10-15T16:05:27.819924+00:00 app[web.1]: /app/node_modules/mkdirp/index.js:91
2021-10-15T16:05:27.819926+00:00 app[web.1]: throw err0;
2021-10-15T16:05:27.819926+00:00 app[web.1]: ^
2021-10-15T16:05:27.819927+00:00 app[web.1]:
2021-10-15T16:05:27.819927+00:00 app[web.1]: Error: EROFS: read-only file system, mkdir '/public'
2021-10-15T16:05:27.819928+00:00 app[web.1]: at Object.mkdirSync (fs.js:1013:3)
2021-10-15T16:05:27.819928+00:00 app[web.1]: at sync (/app/node_modules/mkdirp/index.js:72:13)
2021-10-15T16:05:27.819928+00:00 app[web.1]: at sync (/app/node_modules/mkdirp/index.js:78:24)
2021-10-15T16:05:27.819929+00:00 app[web.1]: at Function.sync (/app/node_modules/mkdirp/index.js:78:24)
2021-10-15T16:05:27.819929+00:00 app[web.1]: at new DiskStorage (/app/node_modules/multer/storage/disk.js:21:12)
2021-10-15T16:05:27.819930+00:00 app[web.1]: at module.exports (/app/node_modules/multer/storage/disk.js:65:10)
2021-10-15T16:05:27.819930+00:00 app[web.1]: at new Multer (/app/node_modules/multer/index.js:15:20)
2021-10-15T16:05:27.819931+00:00 app[web.1]: at multer (/app/node_modules/multer/index.js:95:12)
2021-10-15T16:05:27.819931+00:00 app[web.1]: at Object.<anonymous> (/app/api/files.js:4:16)
2021-10-15T16:05:27.819931+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1085:14) {
2021-10-15T16:05:27.819932+00:00 app[web.1]: errno: -30,
2021-10-15T16:05:27.819932+00:00 app[web.1]: syscall: 'mkdir',
2021-10-15T16:05:27.819932+00:00 app[web.1]: code: 'EROFS',
2021-10-15T16:05:27.819933+00:00 app[web.1]: path: '/public'
2021-10-15T16:05:27.819933+00:00 app[web.1]: }
2021-10-15T16:05:27.968565+00:00 heroku[web.1]: Process exited with status 1
2021-10-15T16:05:28.098649+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-15T16:05:28.136896+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-15T16:05:30.375434+00:00 heroku[web.1]: Starting process with command `node ./server.js`
2021-10-15T16:05:32.063799+00:00 app[web.1]: connected
2021-10-15T16:05:32.108031+00:00 app[web.1]: /app/node_modules/mkdirp/index.js:91
2021-10-15T16:05:32.108033+00:00 app[web.1]: throw err0;
2021-10-15T16:05:32.108033+00:00 app[web.1]: ^
2021-10-15T16:05:32.108033+00:00 app[web.1]:
2021-10-15T16:05:32.108034+00:00 app[web.1]: Error: EROFS: read-only file system, mkdir '/public'
2021-10-15T16:05:32.108034+00:00 app[web.1]: at Object.mkdirSync (fs.js:1013:3)
2021-10-15T16:05:32.108035+00:00 app[web.1]: at sync (/app/node_modules/mkdirp/index.js:72:13)
2021-10-15T16:05:32.108035+00:00 app[web.1]: at sync (/app/node_modules/mkdirp/index.js:78:24)
2021-10-15T16:05:32.108035+00:00 app[web.1]: at Function.sync (/app/node_modules/mkdirp/index.js:78:24)
2021-10-15T16:05:32.108036+00:00 app[web.1]: at new DiskStorage (/app/node_modules/multer/storage/disk.js:21:12)
2021-10-15T16:05:32.108036+00:00 app[web.1]: at module.exports (/app/node_modules/multer/storage/disk.js:65:10)
2021-10-15T16:05:32.108036+00:00 app[web.1]: at new Multer (/app/node_modules/multer/index.js:15:20)
2021-10-15T16:05:32.108037+00:00 app[web.1]: at multer (/app/node_modules/multer/index.js:95:12)
2021-10-15T16:05:32.108037+00:00 app[web.1]: at Object.<anonymous> (/app/api/files.js:4:16)
2021-10-15T16:05:32.108037+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1085:14) {
2021-10-15T16:05:32.108038+00:00 app[web.1]: errno: -30,
2021-10-15T16:05:32.108041+00:00 app[web.1]: syscall: 'mkdir',
2021-10-15T16:05:32.108041+00:00 app[web.1]: code: 'EROFS',
2021-10-15T16:05:32.108041+00:00 app[web.1]: path: '/public'
2021-10-15T16:05:32.108041+00:00 app[web.1]: }
2021-10-15T16:05:32.267952+00:00 heroku[web.1]: Process exited with status 1
2021-10-15T16:05:32.695933+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-15T16:05:33.707024+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=filedownl12.herokuapp.com request_id=c9fdfd08-1b36-450e-a4de-fb65785677a4 fwd="77.49.34.161" dyno= connect= service= status=503 bytes= protocol=https
2021-10-15T16:05:34.925481+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=filedownl12.herokuapp.com request_id=3aca34c2-47e0-4f99-9884-13b91ed25f99 fwd="77.49.34.161" dyno= connect= service= status=503 bytes= protocol=https
2021-10-15T16:13:09.486503+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=filedownl12.herokuapp.com request_id=e41ba396-2172-4804-a573-0fafc1a2c47b fwd="77.49.34.161" dyno= connect= service= status=503 bytes= protocol=https
2021-10-15T16:13:10.694600+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=filedownl12.herokuapp.com request_id=4ef46b32-012c-43b2-8342-0a0637d5a29b fwd="77.49.34.161" dyno= connect= service= status=503 bytes= protocol=https
I also tried to be sure if I set the variables for MONGO_URI,I also set them. Also I created a procfile and write inside it
web: node ./server.js
But it didnt works. I lastly want to share my directories picture.
I have a reactjs / nodejs app being run, and I am trying to host with Heroku... The app is deployed live, but I cant actually load anything. In my logs I see this:
2021-04-18T23:41:58.000000+00:00 app[api]: Build succeeded
2021-04-18T23:42:14.395000+00:00 app[web.1]: npm WARN shared#1.0.0 No description
2021-04-18T23:42:14.422024+00:00 app[web.1]: npm WARN shared#1.0.0 No repository field.
2021-04-18T23:42:14.422890+00:00 app[web.1]:
2021-04-18T23:42:14.682226+00:00 app[web.1]: added 1 package from 6 contributors and audited 486 packages in 17.344s
2021-04-18T23:42:15.300879+00:00 app[web.1]: found 56017 vulnerabilities (40514 low, 15 moderate, 15488 high)
2021-04-18T23:42:15.300903+00:00 app[web.1]: run `npm audit fix` to fix them, or `npm audit` for details
2021-04-18T23:42:15.361457+00:00 app[web.1]: /app/.heroku/node/lib/node_modules/shared -> /app/shared
2021-04-18T23:42:15.391152+00:00 app[web.1]: /app/react-web/node_modules/shared -> /app/.heroku/node/lib/node_modules/shared -> /app/shared
2021-04-18T23:42:16.015673+00:00 app[web.1]:
2021-04-18T23:42:16.015683+00:00 app[web.1]: > react-web#0.1.0 start /app/react-web
2021-04-18T23:42:16.015687+00:00 app[web.1]: > node --max_old_space_size=2560 checkEnvironmentForBuild && react-app-rewired start
2021-04-18T23:42:16.015687+00:00 app[web.1]:
2021-04-18T23:42:20.857742+00:00 app[web.1]: ℹ 「wds」: Project is running at http://172.16.225.30/
2021-04-18T23:42:20.858248+00:00 app[web.1]: ℹ 「wds」: webpack output is served from
2021-04-18T23:42:20.858378+00:00 app[web.1]: ℹ 「wds」: Content not from webpack is served from /app/react-web/public
2021-04-18T23:42:20.858506+00:00 app[web.1]: ℹ 「wds」: 404s will fallback to /
2021-04-18T23:42:20.858836+00:00 app[web.1]: Starting the development server...
2021-04-18T23:42:20.858837+00:00 app[web.1]:
2021-04-18T23:42:21.460296+00:00 heroku[web.1]: State changed from starting to up
2021-04-18T23:42:52.656047+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=cleaningassistant.herokuapp.com request_id=3b1180dc-c080-4624-8a97-d9247577dc3f fwd="99.249.30.56" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=https
it is basically saying Request Timeout, when all my start scripts are correct. The only thing it could be looking for is for me to define a port. The problem is, this isn't a nodejs app, its reactjs, so not sure what to do there.
app set up:
please let me know if anyone has any suggestions.
Currently my app works fine locally and can connect to my local database.
Right now this is the error I am getting when i try and run it on heroku:
2014-04-17T06:32:23.404458+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-04-17T06:32:23.404460+00:00 app[web.1]: > node app.js
2014-04-17T06:32:24.052231+00:00 app[web.1]: /public/images/test_image.jpg
2014-04-17T06:32:24.090050+00:00 app[web.1]: Database connection error, fcukkk: [Error: failed to connect to [localhost:27017]]
2014-04-17T06:32:24.084553+00:00 app[web.1]: Express server listening on port 23569
2014-04-17T06:32:24.630834+00:00 heroku[web.1]: State changed from starting to up
2014-04-17T06:33:08.084028+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path=/ host=pure-cliffs-4076.herokuapp.com request_id=9bf3db67-e00e-428a-896c-26c03dfa01ff fwd="68.99.126.105" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0
2014-04-17T06:33:08.094792+00:00 app[web.1]: GET / 200 29995ms
2014-04-17T06:33:08.624842+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=pure-cliffs-4076.herokuapp.com request_id=d09fe61e-f608-47fd-9b1f-a5b4ea54a2a9 fwd="68.99.126.105" dyno=web.1 connect=1ms service=8ms status=404 bytes=193
2014-04-17T06:33:08.620901+00:00 app[web.1]: GET /favicon.ico 404 5ms
2014-04-17T06:33:44.013253+00:00 heroku[web.1]: State changed from up to starting
2014-04-17T06:33:43.925737+00:00 heroku[api]: Add mongolab:sandbox add-on by marshall.a.x#gmail.com
2014-04-17T06:33:43.925801+00:00 heroku[api]: Release v4 created by marshall.a.x#gmail.com
2014-04-17T06:33:47.537662+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-04-17T06:33:48.704235+00:00 he
roku[web.1]: Starting process with command `npm start`
2014-04-17T06:33:49.868707+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-04-17T06:33:49.868699+00:00 app[web.1]:
2014-04-17T06:33:49.868711+00:00 app[web.1]:
2014-04-17T06:33:49.868709+00:00 app[web.1]: > node app.js
2014-04-17T06:33:50.254949+00:00 app[web.1]: /public/images/test_image.jpg
2014-04-17T06:33:50.274924+00:00 app[web.1]: Database connection error, fcukkk: [Error: failed to connect to [localhost:27017]]
2014-04-17T06:33:50.271844+00:00 app[web.1]: Express server listening on port 21153
2014-04-17T06:33:49.631038+00:00 heroku[web.1]: Process exited with status 143
2014-04-17T06:33:50.361358+00:00 heroku[web.1]: State changed from starting to up
2014-04-17T07:38:52.772530+00:00 heroku[web.1]: Idling
2014-04-17T07:38:52.773249+00:00 heroku[web.1]: State changed from up to down
2014-04-17T07:38:56.398500+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-04-17T07:38:59.466635+00:00 heroku[web.1]: Process exited with status 143
2014-04-17T18:18:34.665450+00:00 heroku[web.1]: Unidling
2014-04-17T18:18:34.665450+00:00 heroku[web.1]: State changed from down to starting
2014-04-17T18:18:39.773345+00:00 heroku[web.1]: Starting process with command `npm start`
2014-04-17T18:18:41.209327+00:00 app[web.1]:
2014-04-17T18:18:41.209334+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-04-17T18:18:41.209336+00:00 app[web.1]: > node app.js
2014-04-17T18:18:41.209466+00:00 app[web.1]:
2014-04-17T18:18:41.831107+00:00 app[web.1]: /public/images/test_image.jpg
2014-04-17T18:18:41.863975+00:00 app[web.1]: Database connection error, fcukkk: [Error: failed to connect to [localhost:27017]]
2014-04-17T18:18:41.859394+00:00 app[web.1]: Express server listening on port 56521
2014-04-17T18:18:41.983113+00:00 heroku[web.1]: State changed from starting to up
2014-04-17T18:19:12.750685+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path=/ host=pure-cliffs-4076.herokuapp.com request_id=b7e7cab0-e79f-4457-9e5d-1acbfd494ef0 fwd="68.99.126.105" dyno=web.1 connect=5ms service=30001ms status=503 bytes=0
2014-04-17T18:19:12.754834+00:00 app[web.1]: GET / 200 29995ms
2014-04-17T19:21:21.596778+00:00 heroku[web.1]: Idling
2014-04-17T19:21:21.597514+00:00 heroku[web.1]: State changed from up to down
2014-04-17T19:21:26.046285+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-04-17T19:21:28.181093+00:00 heroku[web.1]: Process exited with status 143
2014-04-17T20:56:21.949618+00:00 heroku[web.1]: Unidling
2014-04-17T20:56:21.949987+00:00 heroku[web.1]: State changed from down to starting
2014-04-17T20:56:31.657944+00:00 heroku[web.1]: Starting process with command `npm start`
2014-04-17T20:56:33.655866+00:00 app[web.1]:
2014-04-17T20:56:33.655871+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-04-17T20:56:33.655873+00:00 app[web.1]: > node app.js
2014-04-17T20:56:33.655875+00:00 app[web.1]:
2014-04-17T20:56:34.682567+00:00 app[web.1]: /public/images/test_image.jpg
2014-04-17T20:56:34.706650+00:00 app[web.1]: Database connection error, fcukkk: [Error: failed to connect to [localhost:27017]]
2014-04-17T20:56:34.703013+00:00 app[web.1]: Express server listening on port 21923
2014-04-17T20:56:35.308394+00:00 heroku[web.1]: State changed from starting to up
2014-04-17T20:57:08.004131+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path=/ host=pure-cliffs-4076.herokuapp.com request_id=033a5a44-68a3-4b1c-8f6c-5755371d076d fwd="68.99.126.105" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0
2014-04-17T20:57:08.005107+00:00 app[web.1]: GET / 200 29992ms
2014-04-17T21:17:36.623084+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path=/ host=pure-cliffs-4076.herokuapp.com request_id=1117b0b1-da9d-4fef-ad79-f1a5c4178807 fwd="68.99.126.105" dyno=web.1 connect=2ms service=30000ms status=503 bytes=0
2014-04-17T21:17:36.625513+00:00 app[web.1]: GET / 200 30000ms
2014-04-17T22:07:00.807923+00:00 heroku[web.1]: Idling
2014-04-17T22:07:00.809134+00:00 heroku[web.1]: State changed from up to down
2014-04-17T22:07:04.732639+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-04-17T22:07:07.514765+00:00 heroku[web.1]: Process exited with status 143
2014-04-17T22:32:27+00:00 heroku[slug-compiler]: Slug compilation started
2014-04-17T22:33:00+00:00 heroku[slug-compiler]: Slug compilation finished
2014-04-17T22:33:00.065665+00:00 heroku[web.1]: State changed from down to starting
2014-04-17T22:32:59.921981+00:00 heroku[api]: Deploy 0e3a24a by marshall.a.x#gmail.com
2014-04-17T22:32:59.922073+00:00 heroku[api]: Release v5 created by marshall.a.x#gmail.com
2014-04-17T22:33:05.771395+00:00 heroku[web.1]: Starting process with command `npm start`
2014-04-17T22:33:07.654364+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-04-17T22:33:07.654367+00:00 app[web.1]:
2014-04-17T22:33:07.654366+00:00 app[web.1]: > node app.js
2014-04-17T22:33:07.654359+00:00 app[web.1]:
2014-04-17T22:33:08.435746+00:00 app[web.1]: /public/images/test_image.jpg
2014-04-17T22:33:08.474993+00:00 app[web.1]: Express server listening on port 20321
2014-04-17T22:33:08.771030+00:00 app[web.1]: sup stud, Database connected.
2014-04-17T22:33:08.770901+00:00 app[web.1]: Succeeded connected to: mongodb://mongodb://heroku_app24230415:l91npmc6qlrdole3ptlq0s8not#ds045157.mongolab.com:45157/heroku_app24230415/images
2014-04-17T22:33:08.577315+00:00 heroku[web.1]: State changed from starting to up
2014-04-17T22:33:48.606992+00:00 app[web.1]: []
2014-04-17T22:33:49.143625+00:00 heroku[router]: at=info method=GET path=/ host=pure-cliffs-4076.herokuapp.com request_id=982dd016-e68c-4190-a41e-c3a6780a06ef fwd="68.99.126.105" dyno=web.1 connect=2ms service=624ms status=500 bytes=7683
2014-04-17T22:33:49.176065+00:00 app[web.1]: 13| form(method="POST" action="/view/#{image._id}" enctype="multipart/form-data")
2014-04-17T22:33:49.176067+00:00 app[web.1]: 14| input(type="image" src="/images/#{image.source}" name="bigImage" width="300")
2014-04-17T22:33:49.176068+00:00 app[web.1]:
2014-04-17T22:33:49.176060+00:00 app[web.1]: 10| li
2014-04-17T22:33:49.176070+00:00 app[web.1]: Cannot read property 'source' of undefined
2014-04-17T22:33:49.176050+00:00 app[web.1]: TypeError: /app/views/index.jade:11
2014-04-17T22:33:49.176063+00:00 app[web.1]: 12| span
2014-04-17T22:33:49.176062+00:00 app[web.1]: > 11| img(src="/images/#{image.source}" name="original")
2014-04-17T22:33:49.176058+00:00 app[web.1]: 9| each image in images
2014-04-17T22:33:49.176078+00:00 app[web.1]: at res (/app/node_modules/jade/lib/jade.js:173:38)
2014-04-17T22:33:49.176071+00:00 app[web.1]: at eval (eval at <anonymous> (/app/node_modules/jade/lib/jade.js:172:8), <anonymous>:78:56)
2014-04-17T22:33:49.176073+00:00 app[web.1]: at eval (eval at <anonymous> (/app/node_modules/jade/lib/jade.js:172:8), <anonymous>:165:4)
2014-04-17T22:33:49.176075+00:00 app[web.1]: at eval (eval at <anonymous> (/app/node_modules/jade/lib/jade.js:172:8), <anonymous>:184:21)
2014-04-17T22:33:49.176079+00:00 app[web.1]: at Object.exports.render (/app/node_modules/jade/lib/jade.js:269:10)
2014-04-17T22:33:49.176084+00:00 app[web.1]: at View.render (/app/node_modules/express/lib/view.js:76:8)
2014-04-17T22:33:49.176081+00:00 app[web.1]: at Object.exports.renderFile (/app/node_modules/jade/lib/jade.js:305:18)
2014-04-17T22:33:49.176082+00:00 app[web.1]: at View.exports.renderFile [as engine] (/app/node_modules/jade/lib/jade.js:290:21)
2014-04-17T22:33:49.176087+00:00 app[web.1]: at ServerResponse.res.render (/app/node_modules/express/lib/response.js:798:7)
2014-04-17T22:33:49.176085+00:00 app[web.1]: at Function.app.render (/app/node_modules/express/lib/application.js:504:10)
2014-04-17T22:33:49.181859+00:00 app[web.1]: GET / 500 607ms
This is the relevant part of my app.js file:
var uristring= 'mongodb://'+process.env.MONGOLAB_URI+'/images';
var theport = process.env.PORT || 5000;
var appDir = path.dirname(require.main.filename);
mongoose.connect(uristring, function(err,res){
if (err) {
console.log('ERROR connecting to: '+uristring+'. ' + err)
}
else {
console.log('Succeeded connected to: '+uristring);
}
});
var conn = mongoose.connection;
conn.on('error', console.error.bind(console, 'Database connection error, fcukkk:'));
conn.once('open', function callback() {console.log("sup stud, Database connected.")});
I am confused because there is no mention in the docs https://devcenter.heroku.com/articles/nodejs-mongoose of actually creating the database that I am trying to connect to. I assume this is something that mongoose does when you initially connect to the db.
Do you realize that you are connecting successfully at the end of the log? The first 3 times it looked for your DB at localhost:27017, but the 4th time it looked for the proper address (it seems).