"- Node version not specified in package.json" while hosting on heroku - node.js

I have a MERN project that I want to host on Heroku, but while deploying it I'm getting an error:- "Push rejected, failed to compile Node.js app. Push failed". below is the package.json file of the server/backend :-
{
"name": "backend",
"version": "1.0.0",
"description": "Blog-Application",
"main": "app.js",
"type": "module",
"scripts": {
"start": "node app.js",
"heroku-postbuild" : "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
},
"author": "",
"license": "ISC",
"dependencies": {
"alert": "^5.0.10",
"bcryptjs": "^2.4.3",
"cors": "^2.8.5",
"express": "^4.18.1",
"mongoose": "^6.3.2",
"nodemon": "^2.0.16",
"popups": "^1.1.3"
}
}
I checked package.json but didn't find any mistake(Taking reference to some videos)...but when I'm running this command:-
git push heroku master
this is showing me:-
Enumerating objects: 61, done.
Counting objects: 100% (61/61), done.
Delta compression using up to 4 threads
Compressing objects: 100% (59/59), done.
Writing objects: 100% (61/61), 1.25 MiB | 235.00 KiB/s, done.
Total 61 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
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): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 16.x...
remote: Downloading and installing node 16.15.1...
remote: Using default npm version: 8.11.0
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote:
remote: added 211 packages, and audited 212 packages in 4s
remote:
remote: 29 packages are looking for funding
remote: run `npm fund` for details
remote:
remote: found 0 vulnerabilities
remote:
remote: -----> Build
remote: Running heroku-postbuild
remote:
remote: > backend#1.0.0 heroku-postbuild
remote: > NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
remote:
remote: npm ERR! code ENOENT
remote: npm ERR! syscall open
remote: npm ERR! path /tmp/build_cf8c0d20/client/package.json
remote: npm ERR! errno -2
remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_cf8c0d20/client/package.json'
remote: npm ERR! enoent This is related to npm not being able to find a file.
remote: npm ERR! enoent
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.aw0ai/_logs/2022-06-13T18_00_08_638Z-debug-0.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: Some possible problems:
remote:
remote: - Node version not specified in package.json
remote: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to blogsite07.
remote:
To https://git.heroku.com/blogsite07.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/blogsite07.git'
Please help me, where I'm doing wrong.

Related

heroku : Conflict: Multiple assets emit different content to the same filename

I don't know much about vue front end but I am hosting it on Heroku it looks easy in documentation and videos but I keep getting this error no matter what I do.
When I push my code on Heroku it gives me this error.
Enumerating objects: 95, done.
Counting objects: 100% (95/95), done.
Delta compression using up to 8 threads
Compressing objects: 100% (91/91), done.
Writing objects: 100% (95/95), 922.85 KiB | 5.49 MiB/s, done.
Total 95 (delta 23), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
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.16.0
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 16.16.0...
remote: Downloading and installing node 16.16.0...
remote: Using default npm version: 8.11.0
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote:
remote: > cashflow#0.1.0 postinstall
remote: > npm run build
remote:
remote:
remote: > cashflow#0.1.0 build
remote: > vue-cli-service build
remote:
remote: All browser targets in the browserslist configuration have supported ES module.
remote: Therefore we don't build two separate bundles for differential loading.
remote:
remote:
remote: - Building for production...
remote: ERROR Failed to compile with 10 errors6:33:06 AM
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/signup.04385344.js.map
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/login.8bbc6e49.js.map
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/dashboard.cb36601d.js.map
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/119.cc0d4e84.js.map
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/206.076964cc.js.map
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/chunk-vendors.c45faf35.js.map
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/218.16810e2b.js.map
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/862.c30a7c87.js.map
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/489.c2352728.js.map
remote:
remote: error
remote:
remote: Conflict: Multiple assets emit different content to the same filename js/939.3bc5670c.js.map
remote:
remote: ERROR Error: Build failed with errors.
remote: Error: Build failed with errors.
remote: at /tmp/build_db7c88fd/node_modules/#vue/cli-service/lib/commands/build/index.js:207:23
remote: at /tmp/build_db7c88fd/node_modules/webpack/lib/webpack.js:148:8
remote: at /tmp/build_db7c88fd/node_modules/webpack/lib/HookWebpackError.js:68:3
remote: at Hook.eval [as callAsync] (eval at create (/tmp/build_db7c88fd/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
remote: at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/tmp/build_db7c88fd/node_modules/tapable/lib/Hook.js:18:14)
remote: at Cache.shutdown (/tmp/build_db7c88fd/node_modules/webpack/lib/Cache.js:150:23)
remote: at /tmp/build_db7c88fd/node_modules/webpack/lib/Compiler.js:1225:15
remote: at Hook.eval [as callAsync] (eval at create (/tmp/build_db7c88fd/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
remote: at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/tmp/build_db7c88fd/node_modules/tapable/lib/Hook.js:18:14)
remote: at Compiler.close (/tmp/build_db7c88fd/node_modules/webpack/lib/Compiler.js:1218:23)
remote: npm ERR! code 1
remote: npm ERR! path /tmp/build_db7c88fd
remote: npm ERR! command failed
remote: npm ERR! command sh -c npm run build
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.mj21d/_logs/2022-08-06T06_32_22_878Z-debug-0.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: Verifying deploy...
remote:
remote: ! Push rejected to crunch-reporting.
remote:
To https://git.heroku.com/crunch-reporting.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/crunch-reporting.git'
I tried a lot of things like defining node version.
I tried using buildpacks on heroku.
I tried changing server.js file .
NO luck
server.js
const express = require('express');
const serveStatic = require("serve-static")
const path = require('path');
app = express();
app.use(serveStatic(path.join(__dirname, 'dist')));
const port = process.env.PORT || 80;
app.listen(port);
console.log("Listening on port : " + port)
package.js
{
"name": "cashflow",
"version": "0.1.0",
"private": true,
"engines": {
"node": "16.16.0"
},
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"postinstall": "npm run build",
"start": "node server.js"
},
"dependencies": {
"axios": "^0.27.2",
"core-js": "^3.8.3",
"vue": "^2.6.14",
"vue-router": "^3.5.1",
"vuetify": "^2.6.0",
"vuex": "^3.6.2"
},
"devDependencies": {
"#vue/cli-plugin-babel": "~5.0.0",
"#vue/cli-plugin-router": "~5.0.0",
"#vue/cli-plugin-vuex": "~5.0.0",
"#vue/cli-service": "~5.0.0",
"express": "^4.18.1",
"sass": "~1.32.0",
"sass-loader": "^10.0.0",
"serve-static": "^1.15.0",
"vue-cli-plugin-vuetify": "~2.5.1",
"vue-template-compiler": "^2.6.14",
"vuetify-loader": "^1.7.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}

How to fix Heroku error "npm ERR! Could not resolve dependency:" with graphql and graphql-iso-date?

I tried to deploy a Node app to Heroku but it resulted in many errors.
I am following the steps for deployment with git but it's not working. On previous occasions, it worked perfectly for me. But now when I try to upload a new app, I ran into this error again.
Steps that I followed for deployment to Heroku:
I create a Heroku app with heroku create command
I initialize git with git init
Add all files with git add .
Commit the changes with git commit -am 'initial commit'
I use heroku git:remote -a fast-tundra-68777 command
And finally I use the next command git push heroku master and
I get this error:
C:\xampp\htdocs\proyectos\multiservicios-espay\server>heroku create
Creating app... done, ? fast-tundra-68777
https://fast-tundra-68777.herokuapp.com/ | https://git.heroku.com/fast-tundra-68777.git
C:\xampp\htdocs\proyectos\multiservicios-espay\server>git init
Initialized empty Git repository in C:/xampp/htdocs/proyectos/multiservicios-espay/server/.git/
C:\xampp\htdocs\proyectos\multiservicios-espay\server>git add .
C:\xampp\htdocs\proyectos\multiservicios-espay\server>git commit -am "initial commit"
[master (root-commit) e8ac181] initial commit
78 files changed, 4654 insertions(+)
...
C:\xampp\htdocs\proyectos\multiservicios-espay\server>git status
On branch master
nothing to commit, working tree clean
C:\xampp\htdocs\proyectos\multiservicios-espay\server>git branch
* master
C:\xampp\htdocs\proyectos\multiservicios-espay\server>heroku git:remote -a fast-tundra-68777
set git remote heroku to https://git.heroku.com/fast-tundra-68777.git
C:\xampp\htdocs\proyectos\multiservicios-espay\server>git push heroku master
Enumerating objects: 123, done.
Counting objects: 100% (123/123), done.
Delta compression using up to 4 threads
Compressing objects: 100% (105/105), done.
Writing objects: 100% (123/123), 46.78 KiB | 1.02 MiB/s, done.
Total 123 (delta 12), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
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): 14.19.0
remote: engines.npm (package.json): >= 7.x
remote:
remote: Resolving node version 14.19.0...
remote: Downloading and installing node 14.19.0...
remote: Bootstrapping npm >= 7.x (replacing 6.14.16)...
remote: npm 8.7.0 installed
remote:
remote: -----> Installing dependencies
remote: Installing node modules (package.json)
remote: npm ERR! code ERESOLVE
remote: npm ERR! ERESOLVE unable to resolve dependency tree
remote: npm ERR!
remote: npm ERR! While resolving: multiservicios-espay-api#1.0.0
remote: npm ERR! Found: graphql#15.7.2
remote: npm ERR! node_modules/graphql
remote: npm ERR! graphql#"15.7.2" from the root project
remote: npm ERR!
remote: npm ERR! Could not resolve dependency:
remote: npm ERR! peer graphql#"^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0-b || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0" from graphql-iso-date#3.6.1
remote: npm ERR! node_modules/graphql-iso-date
remote: npm ERR! graphql-iso-date#"3.6.1" from the root project
remote: npm ERR!
remote: npm ERR! Fix the upstream dependency conflict, or retry
remote: npm ERR! this command with --force, or --legacy-peer-deps
remote: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
remote: npm ERR!
remote: npm ERR! See /tmp/npmcache.vBJ5d/eresolve-report.txt for a full report.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.vBJ5d/_logs/2022-04-24T16_48_10_656Z-debug-0.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: Verifying deploy...
remote:
remote: ! Push rejected to fast-tundra-68777.
remote:
To https://git.heroku.com/fast-tundra-68777.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/fast-tundra-68777.git
And this is my package.json
{
"name": "multiservicios-espay-api",
"version": "1.0.0",
"description": "API de Multiservicios Generales ESPAY",
"main": "main.js",
"scripts": {
"dev": "nodemon main",
"start": "node main",
"reset-heroku-cache": "heroku builds:cache:purge -a multiservicios-espay-api",
"heroku": "git add . && git commit -m \"[]\" && git push heroku HEAD:master"
},
"keywords": [],
"author": "Husdady Mena",
"license": "ISC",
"engines": {
"node": "14.19.0",
"npm": ">= 7.x"
},
"_moduleAliases": {
"#controllers": "./config/controllers",
"#database": "./config/database",
"#graphql": "./config/graphql",
"#middlewares": "./config/middlewares",
"#models": "./config/models",
"#services": "./config/services",
"#utils": "./config/utils",
"#routes": "./routes"
},
"devDependencies": {
"morgan": "1.10.0",
"nodemon": "2.0.13"
},
"dependencies": {
"bcrypt": "5.0.1",
"cloudinary": "1.27.1",
"compression": "1.7.4",
"cors": "2.8.5",
"dotenv": "10.0.0",
"express": "4.17.1",
"express-graphql": "0.12.0",
"graphql": "15.7.2",
"graphql-iso-date": "3.6.1",
"helmet": "4.6.0",
"jsonwebtoken": "8.5.1",
"module-alias": "2.2.2",
"mongoose": "6.0.9",
"multer": "1.4.3",
"nodemailer": "6.7.3",
"nodemailer-smtp-transport": "^2.4.2",
"uuid": "8.3.2"
}
}

Unable to push to Heroku: Cannot find module 'node-linux-x64/package.json'

I'm really stuck and would really appreciate some help. This question was asked previously here Error while pushing to Heroku: Cannot find module 'node-linux-x64/package.json' however, despite trying all the suggestions I was still unable to resolve this problem.
Just like the individual before who posted the problem initially, I am trying to push a full stack Javascript app to Heroku.
I've re-installed all my dependencies and even downgraded my node and npm.
This issue is especially confusing as I am a Windows user, so to be receiving an error about a module regarding linux feels quite strange.
Please help.
C:\Users\Greg\Desktop\GregBots\reactbot> git push heroku master
Enumerating objects: 41, done.
Counting objects: 100% (41/41), done.
Delta compression using up to 8 threads
Compressing objects: 100% (28/28), done.
Writing objects: 100% (28/28), 19.45 KiB | 1.95 MiB/s, done.
Total 28 (delta 15), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 13.6.0
remote: engines.npm (package.json): 6.13.4
remote:
remote: Resolving node version 13.6.0...
remote: Downloading and installing node 13.6.0...
remote: npm 6.13.4 already installed with node
remote:
remote: -----> Restoring cache
remote: Cached directories were not restored due to a change in version of node, npm, yarn or stack
remote: Module installation may take longer for this build
remote:
remote: -----> Installing dependencies
remote: Installing node modules (package.json + package-lock)
remote:
remote: > node#13.8.0 preinstall /tmp/build_5798122e415d759253929a4b5b0a6c16/node_modules/node
remote: > node installArchSpecificPackage
remote:
remote: npm ERR! code ETARGET
remote: npm ERR! notarget No matching version found for node-linux-x64#13.8.0.
remote: npm ERR! notarget In most cases you or one of your dependencies are requesting
remote: npm ERR! notarget a package version that doesn't exist.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.3VsTs/_logs/2020-02-26T01_02_25_357Z-debug.log
remote: internal/modules/cjs/loader.js:976
remote: throw err;
remote: ^
remote:
remote: Error: Cannot find module 'node-linux-x64/package.json'
remote: Require stack:
remote: - /tmp/build_5798122e415d759253929a4b5b0a6c16/node_modules/node/installArchSpecificPackage.js
remote: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:973:15)
remote: at Function.resolve (internal/modules/cjs/helpers.js:78:19)
remote: at ChildProcess.<anonymous> (/tmp/build_5798122e415d759253929a4b5b0a6c16/node_modules/node-bin-setup/index.js:18:27)
remote: at ChildProcess.emit (events.js:321:20)
remote: at maybeClose (internal/child_process.js:1028:16)
remote: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {
remote: code: 'MODULE_NOT_FOUND',
remote: requireStack: [
remote: '/tmp/build_5798122e415d759253929a4b5b0a6c16/node_modules/node/installArchSpecificPackage.js'
remote: ]
remote: }
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! node#13.8.0 preinstall: `node installArchSpecificPackage`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the node#13.8.0 preinstall script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.3VsTs/_logs/2020-02-26T01_02_26_775Z-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: Some possible problems:
remote:
remote: - A module may be missing from 'dependencies' in package.json
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to infinite-sea-94371.
remote:
To https://git.heroku.com/infinite-sea-94371.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/infinite-sea-94371.git'
PS C:\Users\Greg\Desktop\GregBots\reactbot>
Thanks a bunch for your suggestions Mazen. I've went through your advice, but can't deploy to Heroku still. I've now attached my package.json which I am pushing as well to Heroku as Heroku installs the dependencies that are needed as per the package.
{
"name": "reactbot",
"version": "1.0.0",
"description": "React bot",
"main": "index.js",
"engines": {
"node": "13.6.0",
"npm": "6.13.4"
},
"scripts": {
"start": "node index.js",
"backend": "nodemon index.js",
"frontend": "npm run start --prefix client",
"dev": "concurrently \"npm run backend\" \"npm run frontend\"",
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
},
"author": "",
"license": "ISC",
"dependencies": {
"actions-on-google": "^2.12.0",
"body-parser": "^1.19.0",
"dialogflow": "^1.2.0",
"dialogflow-fulfillment": "^0.6.1",
"express": "^4.17.1",
"mongoose": "^5.9.2"
},
"devDependencies": {
"concurrently": "^5.1.0",
"nodemon": "^2.0.2"
}
}
This error might be caused by multiple things:
According to your error, the npm package node-linux-x64 is set to the wrong version that doesn't exist. Remove node-linux-x64 as Heroku installs the most updated version of Node.js for their system or set it to an existing version.
Did you push your package.json file with your code?
You have pushed your node_module to Heroku which has certain versions of some packages that can only work on your distribution/OS.
You might have installed an npm package globally and forgot to include it to your packages.json file.

I'm getting this error when I 'git push heroku master' for my discord.js bot

So I have a discord bot written in js and I wanted to host it using Heroku because you get 1000 hours of hosting per month for free. I read some guides and stuff, but no matter what I did I get this error when I push on Heroku with git push heroku master. (I have Procfile configured):
error
Enumerating objects: 62, done.
Counting objects: 100% (62/62), done.
Delta compression using up to 4 threads
Compressing objects: 100% (54/54), done.
Writing objects: 100% (62/62), 8.80 KiB | 1.76 MiB/s, done.
Total 62 (delta 18), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 10.x
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 10.x...
remote: Downloading and installing node 10.19.0...
remote: Using default npm version: 6.13.4
remote:
remote: -----> Installing dependencies
remote: Installing node modules (package.json + package-lock)
remote:
remote: > node#13.8.0 preinstall /tmp/build_bb6a303ef77491603b3088575e05b576/node_modules/node
remote: > node installArchSpecificPackage
remote:
remote: npm ERR! code ETARGET
remote: npm ERR! notarget No matching version found for node-linux-x64#13.8.0.
remote: npm ERR! notarget In most cases you or one of your dependencies are requesting
remote: npm ERR! notarget a package version that doesn't exist.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.HDmIW/_logs/2020-02-24T17_35_08_149Z-debug.log
remote: internal/modules/cjs/loader.js:638
remote: throw err;
remote: ^
remote:
remote: Error: Cannot find module 'node-linux-x64/package.json'
remote: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
remote: at Function.resolve (internal/modules/cjs/helpers.js:33:19)
remote: at ChildProcess.<anonymous> (/tmp/build_bb6a303ef77491603b3088575e05b576/node_modules/node-bin-setup/index.js:18:27)
remote: at ChildProcess.emit (events.js:198:13)
remote: at maybeClose (internal/child_process.js:982:16)
remote: at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! node#13.8.0 preinstall: `node installArchSpecificPackage`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the node#13.8.0 preinstall script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.HDmIW/_logs/2020-02-24T17_35_08_183Z-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: Some possible problems:
remote:
remote: - A module may be missing from 'dependencies' in package.json
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to b-r-u-h-discord-bot.
remote:
To https://git.heroku.com/b-r-u-h-discord-bot.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/b-r-u-h-discord-bot.git'
package.json
{
"name": "bruh-bot",
"version": "0.0.1",
"description": "This is B R U H bot ",
"main": "index.js",
"scripts": {
"test": "!test",
"start": "node index.js"
},
"author": "da_dev",
"license": "ISC",
"dependencies": {
"#discordjs/uws": "^10.149.0",
"discord.js": "^11.5.1"
},
"engines": {
"node": "10.x"
},
"devDependencies": {},
"repository": {
"type": "git",
"url": "git+https://github.com/da-the-dev/b-r-u-h.git"
},
"bugs": {
"url": "https://github.com/da-the-dev/b-r-u-h/issues"
},
"homepage": "https://github.com/da-the-dev/b-r-u-h#readme"
}
I spent an entire day surfing the web with no success. Maybe someone has an idea of how to deal with this issue?

Failed to push some refs in Heroku

`I tried to push my web application to Heroku but it gave me this error. I searched for similar problems but it didn't help me. I did this before and it worked but when I tried to do it again it failed and I don't know why.
How can I resolve this error?
PS D:\react application> git push heroku master
Enumerating objects: 125, done.
Counting objects: 100% (125/125), done.
Delta compression using up to 4 threads
Compressing objects: 100% (116/116), done.
Writing objects: 100% (125/125), 2.56 MiB | 31.00 KiB/s, done.
Total 125 (delta 29), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Build failed
remote: ! Two different lockfiles found: package-lock.json and yarn.lock
remote:
remote: Both npm and yarn have created lockfiles for this application,
remote: but only one can be used to install dependencies. Installing
remote: dependencies using the wrong package manager can result in missing
remote: packages or subtle bugs in production.
remote:
remote: - To use npm to install your application's dependencies please delete
remote: the yarn.lock file.
remote:
remote: $ git rm yarn.lock
remote:
remote: - To use yarn to install your application's dependences please delete
remote: the package-lock.json file.
remote:
remote: $ git rm package-lock.json
remote:
remote: https://kb.heroku.com/why-is-my-node-js-build-failing-because-of-conflicting-lock-files
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to heroku-react-app-3.
remote:
To https://git.heroku.com/heroku-react-app-3.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/heroku-react-app-3.git'
Here's my application code:
const path = require('path');
const express = require('express');
const app = express();
const publicPath = path.join(__dirname, '..','public');
const port = process.env.PORT || 3000;
app.use(express.static(publicPath));
app.get('*', (req,res) => {
res.sendFile(path.join(publicPath,'index.html'))
});
app.listen(port, () => {
console.log('Server is up');
});
after deleting yarn.lock
PS D:\react application> git push heroku master
Enumerating objects: 130, done.
Counting objects: 100% (130/130), done.
Delta compression using up to 4 threads
Compressing objects: 100% (121/121), done.
Writing objects: 100% (130/130), 2.56 MiB | 33.00 KiB/s, done.
Total 130 (delta 32), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 10.16.0
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 10.16.0...
remote: Downloading and installing node 10.16.0...
remote: Using default npm version: 6.9.0
remote:
remote: -----> Installing dependencies
remote: Installing node modules (package.json + package-lock)
remote:
remote: > node-sass#4.12.0 install /tmp/build_fa4b97b82e26e28c8efaef8a02fd356e/node_modules/node-sass
remote: > node scripts/install.js
remote:
remote: Downloading binary from https://github.com/sass/node-sass/releases/download/v4.12.0/linux-x64-64_binding.node
remote: Download complete
remote: Binary saved to /tmp/build_fa4b97b82e26e28c8efaef8a02fd356e/node_modules/node-sass/vendor/linux-x64-64/binding.node
remote: Caching binary to /tmp/npmcache.jQpTT/node-sass/4.12.0/linux-x64-64_binding.node
remote:
remote: > core-js#2.6.9 postinstall /tmp/build_fa4b97b82e26e28c8efaef8a02fd356e/node_modules/core-js
remote: > node scripts/postinstall || echo "ignore"
remote:
remote:
remote: > uglifyjs-webpack-plugin#0.4.6 postinstall /tmp/build_fa4b97b82e26e28c8efaef8a02fd356e/node_modules/uglifyjs-webpack-plugin
remote: > node lib/post_install.js
remote:
remote:
remote: > node-sass#4.12.0 postinstall /tmp/build_fa4b97b82e26e28c8efaef8a02fd356e/node_modules/node-sass
remote: > node scripts/build.js
remote:
remote: Binary found at /tmp/build_fa4b97b82e26e28c8efaef8a02fd356e/node_modules/node-sass/vendor/linux-x64-64/binding.node
remote: Testing binary
remote: Binary is fine
remote: added 1139 packages from 774 contributors and audited 16655 packages in 26.036s
remote: found 36 vulnerabilities (31 low, 2 moderate, 3 high)
remote: run `npm audit fix` to fix them, or `npm audit` for details
remote:
remote: -----> Build
remote: Detected both "build" and "heroku-postbuild" scripts
remote: Running heroku-postbuild
remote:
remote: > expensify#1.0.0 heroku-postbuild /tmp/build_fa4b97b82e26e28c8efaef8a02fd356e
remote: > yarn run build:prod
remote:
remote: sh: 1: yarn: not found
remote: npm ERR! file sh
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno ENOENT
remote: npm ERR! syscall spawn
remote: npm ERR! expensify#1.0.0 heroku-postbuild: `yarn run build:prod`
remote: npm ERR! spawn ENOENT
remote: npm ERR!
remote: npm ERR! Failed at the expensify#1.0.0 heroku-postbuild script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.jQpTT/_logs/2019-06-11T22_03_49_679Z-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: Verifying deploy...
remote:
remote: ! Push rejected to heroku-react-app-3.
remote:
To https://git.heroku.com/heroku-react-app-3.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/heroku-react-app-3.git'
my scripts
"engines": {
"node":"10.16.0"
},
"scripts": {
"serve": "live-server public/",
"build": "webpack",
"build:dev": "webpack",
"build:prod": "webpack -p --env production",
"dev-server": "webpack-dev-server",
"test": "jest --config=jest.config.json",
"start": "node server/server.js",
"heroku-postbuild": "yarn run build:prod"
}
As given the problem is that you are having both package-lock.json and yarn.lock
The heroku uses other servers to deploy your app hence it needs to download the dependencies on that remote server.
As you have two dependencies files so heroku can not decide which one to use to download dependencies hence the error.
Delete the one that you are not using(generally yarn.json) and your app will be good to go.

Resources