I used to push my local repo into Heroku without any issue, then I had to downgrade Node from 17.3.0 to 16.14.0, afterward I have been running into this error.
Error Log on Heroku:
This is my package.json
:
{
"dependencies": {
"bcrypt": "^5.0.1",
"body": "^5.1.0",
"body-parser": "^1.19.1",
"cors": "^2.8.5",
"express": "^4.17.2",
"express-validator": "^6.14.0",
"jsonwebtoken": "^8.5.1",
"mongodb": "^4.3.0",
"mongoose": "^6.1.8",
"morgan": "^1.10.0",
"node": "^16.14.0",
"parsr": "^0.0.1",
"passport": "^0.5.2",
"passport-jwt": "^4.0.0",
"passport-local": "^1.0.0",
"sequelize": "^6.12.5",
"uuid": "^8.3.2"
},
"scripts": {
"start": "node index.js"
},
"name": "movie",
"description": "To build the server-side component of a “movies” web application. The web application will provide users with access to information about different movies, directors, and genres. Users will be able to sign up, update their personal information, and create a list of their favorite movies",
"version": "1.0.0",
"main": "index.js",
"keywords": [],
"author": "",
"license": "ISC"
}
And here is my package-lock.json
under the voice "package":
"packages": {
"": {
"name": "movie",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"bcrypt": "^5.0.1",
"body": "^5.1.0",
"body-parser": "^1.19.1",
"cors": "^2.8.5",
"express": "^4.17.2",
"express-validator": "^6.14.0",
"jsonwebtoken": "^8.5.1",
"mongodb": "^4.3.0",
"mongoose": "^6.1.8",
"morgan": "^1.10.0",
"node": "^17.3.1",
"parsr": "^0.0.1",
"passport": "^0.5.2",
"passport-jwt": "^4.0.0",
"passport-local": "^1.0.0",
"sequelize": "^6.12.5",
"uuid": "^8.3.2"
}
As you can see there are two different versions of Node reported...
.gitignore
has already:
node_modules
What is the problem, and how can I fix it?
CodePudding user response:
Ran into this one a few times ago. If your local version of node.js is not Heroku one, you should add theses lines into you package.json:
"engines": {
"node": "your_node_version" // in my case it was 14.x
},
CodePudding user response:
In the end, I used a version from my Repo that worked fine and that I was able to push on Heroku. I applied what I need to change and uploaded it again without issues.