my app works fine local. But when I upload it to github and try to start it with heroku, it says "application error". The build log doesn't show any errors but the app log shows this:
and I think I my port connection is right:
const config = {
port: process.env.PORT || 3000,
};
app.listen(config.port);
package.json:
{
"name": "labo4",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon ."
},
"author": "",
"license": "ISC",
"dependencies": {
"ejs": "^2.5.7",
"express": "^4.16.3",
"glob": "^7.1.2",
"jade": "^1.11.0",
"path": "^0.12.7"
}
}
package.json
{
"name": "labo4",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"ejs": "^2.5.7",
"express": "^4.16.3",
"glob": "^7.1.2",
"jade": "^1.11.0",
"path": "^0.12.7"
}
}
By default Heroku will search for a start in your package.json so edit it as above.
Related
I added valid Environment Variables (PORT and Database URI) to Vercel.
When searching I found that whole project must be wrapped in "api" folder so i did it.
This is my configuration. I added everything I found. Am I missing something or i added something wrong?.
vercel.json
{
"version": 2,
"builds": [
{
"src": "./api/index.ts",
"use": "#vercel/node"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "./api/index.ts"
}
]
}
package.json
{
"name": "back-app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon api/index.ts"
},
"engines": {
"node": "16.x"
},
"author": "",
"license": "ISC",
"devDependencies": {
"#types/express": "^4.17.16",
"#types/mongoose": "^5.11.97",
"#types/node": "^18.11.18",
"#types/nodemon": "^1.19.2",
"nodemon": "^2.0.20",
"typescript": "^4.9.5"
},
"dependencies": {
"body-parser": "^1.20.1",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"mongoose": "^6.9.1"
}
}
Vercel 404 Page`
I tried to deploy my app on vercel
i will delete the node modules file again reinstall npm i but my problem couldn't solve the problem
here's the code ok package.json
{
"name": "backend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "nodemon server.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"bcrypt": "^5.1.0",
"body-parser": "^1.20.1",
"cctx": "^1.0.1",
"dotenv": "^16.0.3",
"express": "npm:Express#^3.0.1",
"Express": "^3.0.1"
},
"devDependencies": {
"nodemon": "^2.0.20"
}
}
im trying to deploy a project to heroku , everything appears to work just fine but when trying to accsess the url given
this is what i see
can anyone have an idea what seems to be the problem?
i've tried looking for a solution via heroku.com but came up short.
if you need a screenshot of anything please tell me what is relevant cause i'm new at this.
here is the package.json for the backend
{
"name": "server",
"version": "1.0.0",
"engines": { "node": "14.x" },
"description": "production ready server",
"main": "server.js",
"scripts": {
"start": "node server.js",
"server:dev": "set NODE_ENV=development&&nodemon server.js",
"server:prod": "set NODE_ENV=production&&node server.js"
},
"author": "Me",
"license": "ISC",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.17.2",
"express-session": "^1.16.2",
"express-socket.io-session": "^1.3.5",
"mongo": "^0.1.0",
"mongodb": "^3.7.3",
"socket.io": "^4.2.0"
},
"devDependencies": {
"nodemon": "1.18.10"
}
}
I'm working on server side coding using Node.js. I've noticed Webpack (I think) is randomly creating dist folder with .dev.js files. I'm not running build, I'm starting server with nodemon npm run start.
Image of what I'm talking about
package.json
{
"name": "card-match-game-server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon index.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"nodemon": "^2.0.6"
},
"dependencies": {
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"jsonwebtoken": "^8.5.1",
"lodash.shuffle": "^4.2.0",
"mongoose": "^5.11.6",
"socket.io": "^3.0.4"
}
}
Can someone clarify why those dist folders are auto generated and the purpose of it? Thanks.
Hi everyone I want to set debugger in my Nightwatchjs project But I got one error
my package.json
{
"name": "intro-to-nightwatchjs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"lint": "eslint .",
"debug": "node --inspect-brk node_modules/.bin/nightwatch",
"test": "nightwatch"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"chromedriver": "^80.0.1",
"eslint": "^6.8.0",
"minimist": "^1.2.5",
"nightwatch": "^1.3.4",
"optimist": "^0.6.1"
}
}