Reputation: 483
Guys i'm trying to make a hosting for my backend app, and this is the second time i do it, the problem is that, i have this error
And, i tried to log my app so i can see where is the error, and this appears
2021-03-21T18:22:21.067459+00:00 heroku[web.1]: Starting process with command `npm run start`
2021-03-21T18:22:25.290401+00:00 app[web.1]:
2021-03-21T18:22:25.290415+00:00 app[web.1]: > [email protected] start /app
2021-03-21T18:22:25.290416+00:00 app[web.1]: > nodemon index.js
2021-03-21T18:22:25.290416+00:00 app[web.1]:
2021-03-21T18:22:25.316554+00:00 app[web.1]: sh: 1: nodemon: not found
2021-03-21T18:22:25.362375+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-03-21T18:22:25.363310+00:00 app[web.1]: npm ERR! syscall spawn
2021-03-21T18:22:25.364814+00:00 app[web.1]: npm ERR! file sh
2021-03-21T18:22:25.365654+00:00 app[web.1]: npm ERR! errno ENOENT
2021-03-21T18:22:25.388201+00:00 app[web.1]: npm ERR! [email protected] start: `nodemon index.js`
2021-03-21T18:22:25.388571+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-03-21T18:22:25.389012+00:00 app[web.1]: npm ERR!
2021-03-21T18:22:25.389281+00:00 app[web.1]: npm ERR! Failed at the
[email protected] start script.
2021-03-21T18:22:25.389521+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-03-21T18:22:25.400950+00:00 app[web.1]:
2021-03-21T18:22:25.401357+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-03-21T18:22:25.401620+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-03-21T18_22_25_390Z-debug.log
2021-03-21T18:22:25.500796+00:00 heroku[web.1]: Process exited with
status 1
2021-03-21T18:22:25.573335+00:00 heroku[web.1]: State changed from starting to crashed
2021-03-21T18:22:25.576936+00:00 heroku[web.1]: State changed from crashed to starting
2021-03-21T18:22:28.365986+00:00 heroku[web.1]: Starting process with command `npm run start`
2021-03-21T18:22:30.896431+00:00 app[web.1]:
2021-03-21T18:22:30.896468+00:00 app[web.1]: > [email protected] start /app
2021-03-21T18:22:30.896468+00:00 app[web.1]: > nodemon index.js
2021-03-21T18:22:30.896468+00:00 app[web.1]:
2021-03-21T18:22:30.907038+00:00 app[web.1]: sh: 1: nodemon: not found
2021-03-21T18:22:30.919190+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-03-21T18:22:30.919692+00:00 app[web.1]: npm ERR! syscall spawn
2021-03-21T18:22:30.919949+00:00 app[web.1]: npm ERR! file sh
2021-03-21T18:22:30.920239+00:00 app[web.1]: npm ERR! errno ENOENT
2021-03-21T18:22:30.927062+00:00 app[web.1]: npm ERR! [email protected] start: `nodemon index.js`
2021-03-21T18:22:30.927284+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-03-21T18:22:30.927492+00:00 app[web.1]: npm ERR!
2021-03-21T18:22:30.927684+00:00 app[web.1]: npm ERR! Failed at the
[email protected] start script.
2021-03-21T18:22:30.927851+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-03-21T18:22:30.963521+00:00 app[web.1]:
2021-03-21T18:22:30.963855+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-03-21T18:22:30.964051+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-03-21T18_22_30_928Z-debug.log
2021-03-21T18:22:31.015557+00:00 heroku[web.1]: Process exited with
status 1
2021-03-21T18:22:31.101810+00:00 heroku[web.1]: State changed from starting to crashed
2021-03-21T18:22:44.381282+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=daily-mern.herokuapp.com
request_id=836abccf-8d2c-432d-a50f-53810887e9ad fwd="177.254.11.56"
dyno= connect= service= status=503 bytes= protocol=https
2021-03-21T18:22:48.388632+00:00 heroku[router]: at=error code=H10 d
PS C:\Users\diego cifuentes\Desktop\Portafolio\Fullstack Projects\Daily App - MERN\server> heroku restartRestarting dynos on ⬢ daily-mern... done
PS C:\Users\diego cifuentes\Desktop\Portafolio\Fullstack Projects\Daily App - MERN\server> heroku logs --tail --app daily-mern
2021-03-21T18:15:05.905941+00:00 app[api]: Initial release by user [email protected]
2021-03-21T18:15:05.905941+00:00 app[api]: Release v1 created by user [email protected]
2021-03-21T18:15:06.053078+00:00 app[api]: Release v2 created by user [email protected]
2021-03-21T18:15:06.053078+00:00 app[api]: Enable Logplex by user [email protected]
2021-03-21T18:21:59.000000+00:00 app[api]: Build started by user [email protected]
2021-03-21T18:22:16.855697+00:00 app[api]: Deploy 81dac1f3 by user [email protected]
2021-03-21T18:22:16.855697+00:00 app[api]: Release v3 created by user [email protected]
2021-03-21T18:22:16.875164+00:00 app[api]: Scaled to web@1:Free by user [email protected]
2021-03-21T18:22:17.000000+00:00 app[api]: Build succeeded
2021-03-21T18:22:21.067459+00:00 heroku[web.1]: Starting process with command `npm run start`
2021-03-21T18:22:25.290401+00:00 app[web.1]:
2021-03-21T18:22:25.290415+00:00 app[web.1]: > [email protected] start /app
2021-03-21T18:22:25.290416+00:00 app[web.1]: > nodemon index.js
2021-03-21T18:22:25.290416+00:00 app[web.1]:
2021-03-21T18:22:25.316554+00:00 app[web.1]: sh: 1: nodemon: not found
2021-03-21T18:22:25.362375+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-03-21T18:22:25.363310+00:00 app[web.1]: npm ERR! syscall spawn
2021-03-21T18:22:25.364814+00:00 app[web.1]: npm ERR! file sh
2021-03-21T18:22:25.365654+00:00 app[web.1]: npm ERR! errno ENOENT
2021-03-21T18:22:25.388201+00:00 app[web.1]: npm ERR! [email protected] start: `nodemon index.js`
2021-03-21T18:22:25.388571+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-03-21T18:22:25.389012+00:00 app[web.1]: npm ERR!
2021-03-21T18:22:25.389281+00:00 app[web.1]: npm ERR! Failed at the
[email protected] start script.
2021-03-21T18:22:25.389521+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-03-21T18:22:25.400950+00:00 app[web.1]:
2021-03-21T18:22:25.401357+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-03-21T18:22:25.401620+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-03-21T18_22_25_390Z-debug.log
2021-03-21T18:22:25.500796+00:00 heroku[web.1]: Process exited with
status 1
2021-03-21T18:22:25.573335+00:00 heroku[web.1]: State changed from starting to crashed
2021-03-21T18:22:25.576936+00:00 heroku[web.1]: State changed from crashed to starting
2021-03-21T18:22:28.365986+00:00 heroku[web.1]: Starting process with command `npm run start`
2021-03-21T18:22:30.896431+00:00 app[web.1]:
2021-03-21T18:22:30.896468+00:00 app[web.1]: > [email protected] start /app
2021-03-21T18:22:30.896468+00:00 app[web.1]: > nodemon index.js
2021-03-21T18:22:30.896468+00:00 app[web.1]:
2021-03-21T18:22:30.907038+00:00 app[web.1]: sh: 1: nodemon: not found
2021-03-21T18:22:30.919190+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-03-21T18:22:30.919692+00:00 app[web.1]: npm ERR! syscall spawn
2021-03-21T18:22:30.919949+00:00 app[web.1]: npm ERR! file sh
2021-03-21T18:22:30.920239+00:00 app[web.1]: npm ERR! errno ENOENT
2021-03-21T18:22:30.927062+00:00 app[web.1]: npm ERR! [email protected] start: `nodemon index.js`
2021-03-21T18:22:30.927284+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-03-21T18:22:30.927492+00:00 app[web.1]: npm ERR!
2021-03-21T18:22:30.927684+00:00 app[web.1]: npm ERR! Failed at the
[email protected] start script.
2021-03-21T18:22:30.927851+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-03-21T18:22:30.963521+00:00 app[web.1]:
2021-03-21T18:22:30.963855+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-03-21T18:22:30.964051+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-03-21T18_22_30_928Z-debug.log
2021-03-21T18:22:31.015557+00:00 heroku[web.1]: Process exited with
status 1
2021-03-21T18:22:31.101810+00:00 heroku[web.1]: State changed from starting to crashed
2021-03-21T18:22:44.381282+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=daily-mern.herokuapp.com
request_id=836abccf-8d2c-432d-a50f-53810887e9ad fwd="177.254.11.56"
dyno= connect= service= status=503 bytes= protocol=https
2021-03-21T18:22:48.388632+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=daily-mern.herokuapp.com request_id=4872869b-653b-411c-8041-6c74f2c933d1 fwd="177.254.11.56" dyno= connect= service= status=503 bytes= protocol=https
2021-03-21T18:23:28.033455+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=daily-mern.herokuapp.com
request_id=938148d2-e2b9-44ec-b0e3-7c36a15c30bb fwd="177.254.11.56"
dyno= connect= service= status=503 bytes= protocol=https
2021-03-21T18:23:32.633910+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=daily-mern.herokuapp.com request_id=12ce541f-e48b-43f0-895f-4987388d0918 fwd="177.254.11.56" dyno= connect= service= status=503 bytes= protocol=https
2021-03-21T18:33:27.499912+00:00 heroku[web.1]: State changed from crashed to starting
2021-03-21T18:33:30.454323+00:00 heroku[web.1]: Starting process with command `npm run start`
2021-03-21T18:33:33.252960+00:00 app[web.1]:
2021-03-21T18:33:33.252982+00:00 app[web.1]: > [email protected] start /app
2021-03-21T18:33:33.252982+00:00 app[web.1]: > nodemon index.js
2021-03-21T18:33:33.252983+00:00 app[web.1]:
2021-03-21T18:33:33.265627+00:00 app[web.1]: sh: 1: nodemon: not found
2021-03-21T18:33:33.280021+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-03-21T18:33:33.280574+00:00 app[web.1]: npm ERR! syscall spawn
2021-03-21T18:33:33.280907+00:00 app[web.1]: npm ERR! file sh
2021-03-21T18:33:33.281222+00:00 app[web.1]: npm ERR! errno ENOENT
2021-03-21T18:33:33.289740+00:00 app[web.1]: npm ERR! [email protected] start: `nodemon index.js`
2021-03-21T18:33:33.290008+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-03-21T18:33:33.290328+00:00 app[web.1]: npm ERR!
2021-03-21T18:33:33.290552+00:00 app[web.1]: npm ERR! Failed at the
[email protected] start script.
2021-03-21T18:33:33.290851+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-03-21T18:33:33.303493+00:00 app[web.1]:
2021-03-21T18:33:33.304537+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-03-21T18:33:33.304746+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-03-21T18_33_33_292Z-debug.log
2021-03-21T18:33:33.372157+00:00 heroku[web.1]: Process exited with
status 1
2021-03-21T18:33:33.483971+00:00 heroku[web.1]: State changed from starting to crashed
2021-03-21T18:35:58.992675+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=daily-mern.herokuapp.com
request_id=af1f361c-1574-4a32-8f68-a7f0830c007a fwd="177.254.11.56"
dyno= connect= service= status=503 bytes= protocol=https
2021-03-21T18:36:01.295985+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=daily-mern.herokuapp.com request_id=759fada6-a151-4bdd-8689-5eab38ceaf35 fwd="177.254.11.56" dyno= connect= service= status=503 bytes= protocol=https
2021-03-21T18:36:27.162149+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=daily-mern.herokuapp.com
request_id=a44bcfca-29b0-4264-bc39-878747caad85 fwd="177.254.11.56"
dyno= connect= service= status=503 bytes= protocol=https
2021-03-21T18:36:30.775177+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=daily-mern.herokuapp.com request_id=ea89bde9-0278-4ded-b9e9-95925bef286b fwd="177.254.11.56" dyno= connect= service= status=503 bytes= protocol=https
I don't understand anything, what is goin on? how can i fix that?
This is my index of my backend, i'm working with node, express and mongoDB
import express from "express";
import mongoose from "mongoose";
import cors from "cors";
import dotenv from "dotenv";
import rooms from "./routes/rooms.js";
import user from "./routes/user.js";
import tasks from "./routes/tasks.js";
dotenv.config();
const PORT = process.env.PORT || 5000;
const app = express();
app.use(express.json({ limit: "20mb", extended: true }));
app.use(express.urlencoded({ limit: "20mb", extended: true }));
app.use(cors());
app.use("/rooms", rooms);
app.use("/tasks", tasks);
app.use("/user", user);
app.get("/", (req, res) => {
res.send("");
});
mongoose.connect(process.env.MONGODB, {
useNewUrlParser: true,
useUnifiedTopology: true,
dbName: "Daily-App"
});
mongoose.set("useFindAndModify", false);
app.listen(PORT, () => {
console.log("Server Working Succesfully");
});
My procfile
web: npm run start
My package json
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"start": "nodemon index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"bcryptjs": "^2.4.3",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.11.19"
}
}
If you know what's going on, i would love to read your answer, thank your for your time comunnity !
Upvotes: 0
Views: 122
Reputation: 597
Add node version to your package.json: "engines": { "node": "v15.10.0" }
Change the "start" script from "nodemon server.js" to "node server.js". If you want to use nodemone locally, add one more script like : "dev": "nodemon server.js"
and use npm run dev
to start the server locally.
You must push your .env to your heroku server also. Check if you .env file is being ignored in .gitignore.
ps: package.json: I don't see "nodemon" in your "dependencies".
did you installed it? If you installed it, it should be there like : "nodemon": "^2.0.7"
or if you installed it with npm i --save-dev
: "devDependencies": { "nodemon": "^2.0.7" }
Wish this help you.
Upvotes: 1