Webpack error when deploying to heroku (npm Exit Status 2) - heroku

My team mates and I are trying to deploy to Heroku and we've been getting this confusing error/build failure several times over.
Ways we've already troubleshot include:
Making sure devDependencies are in Dependencies
Deleted and reinstalled Wepback
deleted the lock files
cleared the npm cache
Created a new heroku app and attempted to deploy there with a fresh start
None of these have worked and we'd really appreciate the help. Thanks!
remote: -----> Building dependencies
remote: Installing node modules (package.json + package-lock)
remote:
remote: > sensation-mapping#0.0.1 postinstall /tmp/build_165cca2bcbc98089b28e7f67a5aa96ab
remote: > webpack
remote:
remote: Hash: be40b95d0b5157875598
remote: Version: webpack 3.12.0
remote: Time: 1767ms
remote: Asset Size Chunks Chunk Names
remote: bundle.js 801 kB 0 [emitted] [big] main
remote: bundle.js.map 943 kB 0 [emitted] main
remote: [12] ./client/index.js 543 bytes {0} [built]
remote: + 24 hidden modules
remote:
remote: ERROR in ./client/index.js
remote: Module not found: Error: Can't resolve './components/App' in '/tmp/build_165cca2bcbc98089b28e7f67a5aa96ab/client'
remote: # ./client/index.js 11:11-38
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 2
remote: npm ERR! sensation-mapping#0.0.1 postinstall: `webpack`
remote: npm ERR! Exit status 2
remote: npm ERR!
remote: npm ERR! Failed at the sensation-mapping#0.0.1 postinstall 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.6UwNM/_logs/2018-06-07T02_48_08_002Z-debug.log
remote:
remote: -----> Build failed

Things you can do to try and resolve the issue:
Check log for any issues.
Check code for any missing references to modules that might be called but doesn't exist.
After doing the above steps try and build again and see what happens.

Related

Heroku deploy failing? Probably because of dependencies

remote: -----> Installing dependencies
remote: Installing node modules
remote: npm ERR! code ERESOLVE
remote: npm ERR! ERESOLVE could not resolve
remote: npm ERR!
remote: npm ERR! While resolving: react-rss#2.0.1
remote: npm ERR! Found: react#18.2.0
remote: npm ERR! node_modules/react
remote: npm ERR! react#"^18.2.0" from the root project
remote: npm ERR! peer react#"^18.0.0" from #testing-library/react#13.4.0
remote: npm ERR! node_modules/#testing-library/react
remote: npm ERR! #testing-library/react#"^13.4.0" from the root project
remote: npm ERR! 4 more (react-dom, react-router, react-router-dom, react-scripts)
remote: npm ERR!
remote: npm ERR! Could not resolve dependency:
remote: npm ERR! peer react#"^16.13.1" from react-rss#2.0.1
remote: npm ERR! node_modules/react-rss
remote: npm ERR! react-rss#"^2.0.1" from the root project
remote: npm ERR!
remote: npm ERR! Conflicting peer dependency: react#16.14.0
remote: npm ERR! node_modules/react
remote: npm ERR! peer react#"^16.13.1" from react-rss#2.0.1
remote: npm ERR! node_modules/react-rss
remote: npm ERR! react-rss#"^2.0.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.zVSUf/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.zVSUf/_logs/2022-11-03T19_15_38_788Z-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: !
remote: ! ## Warning - The same version of this code has already been built: ea132e7d82ff4a3fe3121b0858e49a2c8336bec0
remote: !
remote: ! We have detected that you have triggered a build from source code with version ea132e7d82ff4a3fe3121b0858e49a2c8336bec0
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 tb-work-hub.
remote:
To https://git.heroku.com/tb-work-hub.git
! [remote rejected] master -> master (pre-receive hook declined)
I don't understand this. It was working just fine yesterday. I'm guessing it's to do with some dependencies I was trying to work with?
If there isn't a clean solution, is there a good way to restore my app without having to start fresh, reinstall everything and copy-paste the src?
Tried: npm uninstall react-rss
Go to the app in Heroku -> settings -> Reveal Config Vars
Add a new config var with the key: NPM_CONFIG_LEGACY_PEER_DEPS and value true, and then redeploy.
(Heroku Shopify Application Error 'npm ERR! ERESOLVE unable to resolve dependency tree')
I hope it works.

Heroku deployment failing on github request

I'm trying to deploy an old application to heroku but I keep getting the following error:
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
remote: npm ERR! Error while executing:
remote: npm ERR! /usr/bin/git ls-remote -h -t ssh://git#github.com/bessdsv/bower-installer.git
remote: npm ERR!
remote: npm ERR! Host key verification failed.
remote: npm ERR! fatal: Could not read from remote repository.

Heroku Build Failing Due To Code Integrity

I have an application deployed on Heroku and I have not had problems redeploying it, up until yesterday.
I had to upgrade one of the dependencies in my package-lock.json/yarn.lock files and when trying to upload it to Heroku, I get the following:
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.15.x
remote: engines.npm (package.json): 6.14.x
remote:
remote: Resolving node version 10.15.x...
remote: Downloading and installing node 10.15.3...
remote: Bootstrapping npm 6.14.x (replacing 6.4.1)...
remote: npm 6.14.x installed
remote:
remote: -----> Installing dependencies
remote: Installing node modules (package.json + package-lock)
remote: npm ERR! code EINTEGRITY
remote: npm ERR! sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= integrity checksum failed when using sha1: wanted sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= but got sha512-rIqbOrKb8GJmx/5bc2M0QchhUouMXSpd1RTclXsB41JdL+VtnojfaJR+h7F9k18/4kHUsBFgk80Uk+q569vjPA== sha1-sAoAIwoRCMSMFp5popGq/aOqzWM=. (7897 bytes)
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.P3BnU/_logs/2020-03-18T06_17_36_985Z-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
I realize the problem resides within this line:
npm ERR! code EINTEGRITY
remote: npm ERR! sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= integrity checksum failed when using sha1: wanted sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= but got sha512-rIqbOrKb8GJmx/5bc2M0QchhUouMXSpd1RTclXsB41JdL+VtnojfaJR+h7F9k18/4kHUsBFgk80Uk+q569vjPA== sha1-sAoAIwoRCMSMFp5popGq/aOqzWM=. (7897 bytes)
but I do not know why it is occurring now or what triggered it (as it did not happen before).
I have tried searching online and clearing the cache, reading Heroku's Node.js Troubleshooting, adding an engines key to my package.json file to specify node/npm versions, but nothing works.
I have NOT upgraded Node/NPM in my development environment, so those versions are the same.
Per #TinNguyen's comment, I executed the following commands:
npm uninstall package_name
and then :
npm install package_name
and that seemed to fix the issue.
I simply deleted package-lock.json and npm modules, then run npm install.
I had the same issue and fixed it.
Probably you have npm vulnerabilities and if you cant fix them all
try upgrading all you packages in package.json
useful tool is
npm install -g npm-check-updates
then
ncu --upgrade
then
npm install
make sure to delete package-lock.json before npm install
Simply: delete package-lock.json and run npm install

failed to push some refs to 'https://git.heroku.com/easy-instagram.git'

I have generated my angualr2 app using ng new project command, and now i am trying to put my project on heroku, unfortunatly, I faced with an error when i pushed my code with git push heroku master:
Counting objects: 65, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (62/62), done.
Writing objects: 100% (65/65), 363.09 KiB | 0 bytes/s, done.
Total 65 (delta 5), 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: NPM_CONFIG_PRODUCTION=true
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 (latest stable) via semver.io...
remote: Downloading and installing node 5.11.1...
remote: Using default npm version: 3.8.6
remote:
remote: -----> Restoring cache
remote: Skipping cache restore (new runtime signature)
remote:
remote: -----> Building dependencies
remote: Installing node modules (package.json)
remote:
remote: > qminder#0.0.0 postinstall /tmp/build_a0673d10d05036142a147f64099bd6fb
remote: > typings install
remote:
remote: sh: 1: typings: not found
remote:
remote: npm ERR! Linux 3.13.0-91-generic
remote: npm ERR! argv "/tmp/build_a0673d10d05036142a147f64099bd6fb/.heroku/node/bin/node" "/tmp/build_a0673d10d05036142a147f64099bd6fb/.heroku/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_a0673d10d05036142a147f64099bd6fb/.npmrc"
remote: npm ERR! node v5.11.1
remote: npm ERR! npm v3.8.6
remote: npm ERR! file sh
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno ENOENT
remote: npm ERR! syscall spawn
remote: npm ERR! qminder#0.0.0 postinstall: `typings install`
remote: npm ERR! spawn ENOENT
remote: npm ERR!
remote: npm ERR! Failed at the qminder#0.0.0 postinstall script 'typings install'.
remote: npm ERR! Make sure you have the latest version of node.js and npm installed.
remote: npm ERR! If you do, this is most likely a problem with the qminder package,
remote: npm ERR! not with npm itself.
remote: npm ERR! Tell the author that this fails on your system:
remote: npm ERR! typings install
remote: npm ERR! You can get information on how to open an issue for this project with:
remote: npm ERR! npm bugs qminder
remote: npm ERR! Or if that isn't available, you can get their info via:
remote: npm ERR! npm owner ls qminder
remote: npm ERR! There is likely additional logging output above.
remote:
remote: npm ERR! Please include the following file with any support request:
remote: npm ERR! /tmp/build_a0673d10d05036142a147f64099bd6fb/npm-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 easy-instagram.
remote:
To https://git.heroku.com/easy-instagram.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/easy-instagram.git'
So, is there anything that i can add to my project to fix this problem?
I have mannually added the node version to my config.json file, but it still complains with the same error:
"devDependencies": {
"angular-cli": "1.0.0-beta.10",
"codelyzer": "0.0.20",
"ember-cli-inject-live-reload": "1.4.0",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "0.13.22",
"karma-chrome-launcher": "0.2.3",
"karma-jasmine": "0.3.8",
"protractor": "3.3.0",
"ts-node": "0.5.5",
"tslint": "3.11.0",
"typescript": "1.8.10",
"typings": "1.3.1",
"node":"4.4.0"
}
Looks like Heroku doesn't install your devDependencies
There are two possible variants how to fix it:
Move typings inside dependencies:
"dependencies": {
...
"typings": "^2.1.0",
...
OR
NPM_CONFIG_PRODUCTION needs to be set to false for Heroku to install devDependencies

npm ERR! fetch failed status code 502

I'm using Codeship to deploy my Ember project to Heroku. These deployments used to work without a problem but since yesteday they fail with "npm ERR! fetch failed ..." when installing the npm dependencies in step (6). I haven't changed anything since then and resetting the dependency cache has not helped.
Anyone familiar with this issue?
I'm using:
ember-cli 3.3.12
npm v3.8.6
node v5.11.1
- ...
- (step 1) ember test
- (step 2) Exporting Heroku API Key
- (step 3) check_access_to_heroku_app my_project
- (step 4) Preparing repository for Heroku deployment
- (step 5) git remote add heroku_my_project git#heroku.com:my_project.git
- (step 6) git push heroku_tnt-ui $CI_COMMIT_ID:refs/heads/master
---- Log of Step 6 -----
Counting objects: 69, done.
Delta compression using up to 32 threads.
Compressing objects: 100% (17/17), done.
Writing objects: 100% (36/36), 6.48 KiB | 0 bytes/s, done.
Total 36 (delta 23), reused 31 (delta 19)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Fetching set buildpack https://github.com/tonycoco/heroku-buildpack-ember-cli.git... done
remote: -----> Ember CLI app detected
remote: -----> Exporting config vars to environment
remote: -----> Building environment: production
remote:
remote: PRO TIP: Avoid using semver ranges starting with '>' in engines.node
remote: See https://devcenter.heroku.com/articles/nodejs-support
remote:
remote: -----> Requested node range: >= 0.10.0
remote: -----> Resolved node version: 5.11.1
remote: -----> Downloading and installing node
remote: -----> Using default npm version: 3.8.6
remote: -----> Downloading and installing nginx
remote: -----> Adding boot script
remote: -----> Copying configs
remote: -----> Forcing rebuild of all node_modules. Pruning all node_modules.
remote: -----> Forcing re-installation of all bower_components. Pruning all bower_components.
remote: -----> Creating node_modules cache directory
remote: -----> Creating bower_components cache directory
remote: -----> Pruning cached dependencies not specified in package.json
remote: -----> Installing dependencies
remote: npm ERR! fetch failed https://registry.npmjs.org/ember-cli-sri/-/ember-cli-sri-2.1.0.tgz
remote: npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 502
remote: npm ERR! fetch failed https://registry.npmjs.org/ember-simple-auth/-/ember-simple-auth-1.1.0.tgz
remote: npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 502
remote: npm ERR! fetch failed https://registry.npmjs.org/ember-cli-sri/-/ember-cli-sri-2.1.0.tgz
remote: npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 502
remote: npm ERR! fetch failed https://registry.npmjs.org/ember-simple-auth/-/ember-simple-auth-1.1.0.tgz
remote: npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 502
remote: npm ERR! fetch failed https://registry.npmjs.org/ember-cli-sri/-/ember-cli-sri-2.1.0.tgz
remote: npm ERR! fetch failed https://registry.npmjs.org/ember-simple-auth/-/ember-simple-auth-1.1.0.tgz
remote: npm ERR! Linux 3.13.0-91-generic
remote: npm ERR! argv "/tmp/build_aaa68782965ff56ab3bc/vendor/node/bin/node" "/tmp/build_aaa6878296554310746bc/vendor/node/bin/npm" "install" "--quiet" "--no-optional" "--userconfig" "/tmp/build_aaa6875446ff56ab3bc/.npmrc"
remote: npm ERR! node v5.11.1
remote: npm ERR! npm v3.8.6
remote:
remote: npm ERR! fetch failed with status code 502
remote: npm ERR!
remote: npm ERR! If you need help, you may report this error at:
remote: npm ERR! <https://github.com/npm/npm/issues>
remote:
remote: npm ERR! Please include the following file with any support request:
remote: npm ERR! /tmp/build_aaa687829655456ab3bc/npm-debug.log
remote: 0 info it worked if it ends with ok
remote: 1 verbose cli [ '/tmp/build_aaa68782965546ab3bc/vendor/node/bin/node',
remote: 1 verbose cli '/tmp/build_aaa687846ff56ab3bc/vendor/node/bin/npm',
remote: 1 verbose cli 'install',
remote: 1 verbose cli '--quiet',
remote: 1 verbose cli '--no-optional',
remote: 1 verbose cli '--userconfig',
remote: 1 verbose cli '/tmp/build_aaa68782b46ff56ab3bc/.npmrc' ]
remote: 2 info using npm#3.8.6
remote: 3 info using node#v5.11.1
remote: 4 verbose config Skipping project config: /tmp/build_aaa6878296f56ab3bc/.npmrc. (matches userconfig)
remote: 5 silly loadCurrentTree Starting
remote: 6 silly install loadCurrentTree
remote: 7 silly install readLocalPackageData
remote: 8 silly install normalizeTree
...
This was a bug on npm's server side and got fixed a day later.

Resources