Failed to push some refs in Heroku - node.js

`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.

Related

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

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.

Trouble deploying to Heroku, module can't resolve

Been trying all day to deploy this. Nothing is working. Ran through the entire node troubleshooter link, everything checks out. The where it says cant resolve module, My code is running fine on all severs and can't find the tmp folder, anywhere. I've only been coding a month. Sorry if this is stupid, but I'd appreciate some help.
Matt#DESKTOP-QFMSSDA MINGW64 ~/Desktop/momma-ecommerce (main)
$ git push heroku main
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 4 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 442 bytes | 442.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0), pack-reused 0
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_PRODUCTION=false
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.13.2
remote: engines.npm (package.json): 8.1.2
remote:
remote: Resolving node version 16.13.2...
remote: Downloading and installing node 16.13.2...
remote: npm 8.1.2 already installed with node
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote:
remote: added 252 packages, and audited 253 packages in 9s
remote:
remote: 24 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: > momma-art-sell#1.0.0 heroku-postbuild
remote: > NPM_CONFIG_PRODUCTION=false npm install --prefix frontend && npm run build --
prefix frontend
remote:
remote:
remote: added 1445 packages, and audited 1446 packages in 24s
remote:
remote: 171 packages are looking for funding
remote: run `npm fund` for details
remote:
remote: 7 moderate severity vulnerabilities
remote:
remote: To address issues that do not require attention, run:
remote: npm audit fix
remote:
remote: To address all issues (including breaking changes), run:
remote: npm audit fix --force
remote:
remote: Run `npm audit` for details.
remote:
remote: > frontend#0.1.0 build
remote: > react-scripts build
remote:
remote: Creating an optimized production build...
remote: Failed to compile.
remote:
remote: Module not found: Error: Can't resolve '../components/Message' in
'/tmp/build_4ecd4ad3/frontend/src/screens'
remote:
remote:
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 mjthomasart.
remote:
To https://git.heroku.com/mjthomasart.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/mjthomasart.git'``

Error: failed to push some refs in heroku

I was following a course online on how to deploy in Heroku. I made a Git repository and uploaded and committed all the files there. Then I typed these commands:
heroku create
heroku git:remote -a name_provided_by_heroku
git push heroku main
After command 3 I faced this error in cmd:
Enumerating objects: 4357, done.
Counting objects: 100% (4357/4357), done.
Delta compression using up to 4 threads
Compressing objects: 100% (4125/4125), done.
Writing objects: 100% (4357/4357), 3.64 MiB | 297.00 KiB/s, done.
Total 4357 (delta 935), reused 3 (delta 0), pack-reused 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): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 12.x...
remote: Downloading and installing node 12.20.0...
remote: Using default npm version: 6.14.8
remote:
remote: -----> Installing dependencies
remote: Prebuild detected (node_modules already exists)
remote: Rebuilding any native modules
remote:
remote: > bcrypt#5.0.0 install /tmp/build_88514da7/node_modules/bcrypt
remote: > node-pre-gyp install --fallback-to-build
remote:
remote: sh: 1: node-pre-gyp: Permission denied
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 126
remote: npm ERR! bcrypt#5.0.0 install: `node-pre-gyp install --fallback-to-build`
remote: npm ERR! Exit status 126
remote: npm ERR!
remote: npm ERR! Failed at the bcrypt#5.0.0 install 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.MO7JR/_logs/2020-12-15T17_16_14_007Z-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: - node_modules checked into source control
remote: https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits
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 safe-dawn-68695.
remote:
To https://git.heroku.com/safe-dawn-68695.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/safe-dawn-68695.git'
I am new to Heroku, so I am not able to get what the error is saying. Also tried using git push heroku HEAD:master but faced the same error.
How do I solve this?
Refering this article: node-pre-gyp: Permission denied in heroku push
Remove node_modules folder in your root folder rm -rf node_modules beacuse heroku will install all your dependencies, I hope this will work
So remove your node modules folder and do 1 2 3 again

Heroku deploy error - ! [remote rejected] master -> master (pre-receive hook declined)

I have seen many people get this error, and I've tried every solution I've seen suggested so far. Checking if Heroku knows what kind of app it is, removing .git file from my client folder and so on. In the error message, I can see it is having trouble finding the files, but I don't know how I'd fix this as I did git add -A and git add . numerous time. I am a beginning and I am not sure what I'm missing.
This is the error message when I do git push heroku master:
Counting objects: 100% (13/13), done.
Delta compression using up to 8 threads
Compressing objects: 100% (8/8), done.
Writing objects: 100% (13/13), 13.79 KiB | 1009.00 KiB/s, done.
Total 13 (delta 0), reused 0 (delta 0), pack-reused 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): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 12.x...
remote: Downloading and installing node 12.18.3...
remote: Using default npm version: 6.14.6
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote: added 131 packages in 5.646s
remote:
remote: -----> Build
remote: Running heroku-postbuild
remote:
remote: > mern_project#1.0.0 heroku-postbuild /tmp/build_07c4cff9
remote: > NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
remote:
remote: up to date in 0.242s
remote: found 0 vulnerabilities
remote:
remote: npm ERR! code ENOENT
remote: npm ERR! syscall open
remote: npm ERR! path /tmp/build_07c4cff9/client/package.json
remote: npm ERR! errno -2
remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_07c4cff9/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.LOFwn/_logs/2020-08-28T19_01_14_938Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 254
remote: npm ERR! mern_project#1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run
build --prefix client`
remote: npm ERR! Exit status 254
remote: npm ERR!
remote: npm ERR! Failed at the mern_project#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.LOFwn/_logs/2020-08-28T19_01_14_958Z-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: - 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 floating-island-87176.
remote:
To https://git.heroku.com/floating-island-87176.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/floating-island-87176.git'
Add engines in package.json file
"engines": {
"node": "16.13.0",
"npm": "8.1.0"
},
Then, change version of the package.json
"version":"1.2.1"
Then
git push heroku master
As found in this github issue it was an error with the git repo still thinking client was a submodule. The fix is to remove the client folder from git tracking and add it back as regular files:
git rm -f --cached client && git add . && git commit -m 'Add client folder back to git repo' && git push heroku master
This is what worked for me (The branch is based on 'origin/master', but the upstream might be gone.
(use "git branch --unset-upstream" to fixup))
git branch --unset-upstream

failure to deploy heroku app

Here is the error log:
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: NPM_CONFIG_PRODUCTION=true
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): ~6.11.0
remote: engines.npm (package.json): ~5.0.3
remote:
remote: Resolving node version ~6.11.0 via semver.io...
remote: Downloading and installing node 6.11.1...
remote: Resolving npm version ~5.0.3 via semver.io...
remote: Downloading and installing npm 5.0.4 (replacing version
3.10.10)...
remote:
remote: -----> Restoring cache
remote: Skipping cache restore (new-signature)
remote:
remote: -----> Building dependencies
remote: Prebuild detected (node_modules already exists)
remote: Rebuilding any native modules
remote: npm ERR! path
/tmp/build_9c402097d0e7567eccf5e236dc7f0959/node_modules/jade/bin/jade.js
remote: npm ERR! code ENOENT
remote: npm ERR! errno -2
remote: npm ERR! syscall chmod
remote: npm ERR! enoent ENOENT: no such file or directory, chmod
'/tmp/build_9c402097d0e7567eccf5e236dc7f0959/node_modules/jade/bin/jade.js'
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! /app/.npm/_logs/2017-07-16T02_45_14_132Z-
debug.log
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot
common issues here:
remote:
remote: Some possible problems:
remote:
remote: - node_modules checked into source control
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 pacific-harbor-25184.
remote:
To https://git.heroku.com/pacific-harbor-25184.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/pacific-harbor-25184.git'
How can I get past this build error when deploying to heroku? (even though it works locally)
This is similar to a recent issue in cloudfoundry (but the same idea applies to heroku as well)
Male sure, in your local project, to ignore node_modules first:
echo 'node_modules' >> .gitignore
git rm -r --cached node_modules
git commit -m "ignore node_modules"
Then try your heroku deploy again.

Resources