I'm trying to deploy my node.js app to heroku. I did everything as necessary, but i am getting error like this.
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/nodejs
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 16.3.0
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 16.3.0...
remote: Downloading and installing node 16.3.0...
remote: Using default npm version: 7.15.1
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote: npm ERR! code E404
remote: npm ERR! 404 Not Found - GET https://registry.npmjs.org/har-validator/-/har-validator-5.1.2.tgz - Not found
remote: npm ERR! 404
remote: npm ERR! 404 'har-validator@https://registry.npmjs.org/har-validator/-/har-validator-5.1.2.tgz' is not in the npm registry.
remote: npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
remote: npm ERR! 404
remote: npm ERR! 404 Note that you can also install from a
remote: npm ERR! 404 tarball, folder, http url, or git url.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.7maaf/_logs/2021-06-13T18_35_23_460Z-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:
remote: https://help.heroku.com/
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: !
remote: ! ## Warning - The same version of this code has already been built: 944efd5ebf13ff49831d29f02a9a1f6565355373
remote: !
remote: ! We have detected that you have triggered a build from source code with version 944efd5ebf13ff49831d29f02a9a1f6565355373
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku <branchname>:main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to stark-lowlands-47617.
remote:
To https://git.heroku.com/stark-lowlands-47617.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/stark-lowlands-47617.git'
I tried to do this:
git push heroku master:main
Here is my package.json:
{
"name": "languagelearningapp",
"engines" : { "node" : "16.3.0" },
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"start": "node app.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"basic-auth": "^2.0.1",
"bcrypt": "^3.0.2",
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.3",
"callback": "0.0.1",
"express": "^4.16.4",
"fcm-node": "^1.3.0",
"fcm-notification": "^2.0.0",
"firebase-admin": "^6.2.0",
"jsonwebtoken": "^8.3.0",
"mysql": "^2.16.0",
"nodemon": "^1.18.5",
"sendotp": "^1.2.9"
}
}
But it did not help. I also tried adding node modules to .gitignore, but it didn't work. In particular, I tried switching to a different branch, which did not work well.
PLease help me.
npm ERR! 404 'har-validator@https://registry.npmjs.org/har-validator/-/har-validator-5.1.2.tgz' is not in the npm registry. If you look uphar-validatoron npm here, you can see that the package is deprecatedhar-validatorbeing deprecated. One solution proposed stated that you would start by upgrading the HLS plugin to remove the dependency on request which brings in har-validator, but mind the fact that they usedArtilleryIO.