HEROKU : node-pre-gyp install --fallback-to-build - node.js

I had this problem since I used #discordjs/opus, I saw a big bunch of similar problems everywhere, and nothing helped me changing this error. It always concern node-pre-gyp. I first tried to put it manually in my package.json, and the build suceeded, but there was no sound siplayed, and a lot of warning messages in the build log... Also some people had issues with bcrypt, but it wasn't the case here...
Thanks for your help!
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 12.x...
Downloading and installing node 12.18.4...
Using default npm version: 6.14.6
-----> Restoring cache
- node_modules is checked into source control and cannot be cached
-----> Installing dependencies
Prebuild detected (node_modules already exists)
Rebuilding any native modules
> #discordjs/opus#0.3.2 install /tmp/build_2510a47a_/node_modules/#discordjs/opus
> node-pre-gyp install --fallback-to-build
sh: 1: node-pre-gyp: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! #discordjs/opus#0.3.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the #discordjs/opus#0.3.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.N30Iz/_logs/2020-09-28T09_36_00_646Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Some possible problems:
- node_modules checked into source control
https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits
- Node version not specified in package.json
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed`

Well, as JM-AGMS said, the solution was to make visible package lock, type the node engine in the package, and remove the node modules folder in order to have a succeeded build.
However, the error about node pre-gyp is still there.

Related

sencha extjs npm build on Heroku requires JRE

Trying to get my sencha ExtJS app to compile on heroku. It is an npm app but requires JRE to compile. How do I make JRE available on heroku? my thinking is a build pack but have no idea how to find one that suits my needs or make one.
I appreciate any help that does not include the idea of "don't use extjs". ;)
-----> Building on the Heroku-22 stack
-----> Determining which buildpack to use for this app
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 16.x...
Downloading and installing node 16.17.1...
Using default npm version: 8.15.0
-----> Installing dependencies
Installing node modules
npm ERR! code 126
npm ERR! path /tmp/build_6f27fe6d/node_modules/#sencha/cmd
npm ERR! command failed
npm ERR! command sh /tmp/install-bad0c5cf.sh
npm ERR! i [ext]: platform-install: #sencha/cmd v7.6.0 installed
npm ERR! A JRE is required to download and run Sencha Cmd in linux.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.ImKdt/_logs/2022-10-09T17_30_24_436Z-debug-0.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Some possible problems:
- Node version not specified in package.json
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed

Problems when deploying MERN stack app in Heroku

What is the solution to this problem? I'm getting this error while trying to deploy a MERN stack in Heroku. What I did is: I configured MONGO_URI, PORT, etc. Pushed all working code in Github still getting this error. What should I do to be able to deploy this app successfully? I tried deploying the application by reading Heroku documentation and watching youtube tutorial.
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 14.16.1
engines.npm (package.json): 6.14.12
Resolving node version 14.16.1...
Downloading and installing node 14.16.1...
npm 6.14.12 already installed with node
-----> Installing dependencies
Installing node modules
> nodemon#2.0.7 postinstall /tmp/build_5044977d/node_modules/nodemon
> node bin/postinstall || exit 0
Love nodemon? You can now support the project via the open collective:
> https://opencollective.com/nodemon/donate
> bcrypt#5.0.1 install /tmp/build_5044977d/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build
[bcrypt] Success: "/tmp/build_5044977d/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" is installed via remote
added 365 packages in 9.194s
-----> Build
Running heroku-postbuild
> car-app#1.0.0 heroku-postbuild /tmp/build_5044977d
> NPM_CONFIG_PRODUCTION=false npm install --prefix frontend && npm run build --prefix frontend
up to date in 0.234s
found 0 vulnerabilities
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /tmp/build_5044977d/frontend/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_5044977d/frontend/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.GU88T/_logs/2021-07-02T10_17_10_423Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 254
npm ERR! car-app#1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix frontend && npm run build --prefix frontend`
npm ERR! Exit status 254
npm ERR!
npm ERR! Failed at the car-app#1.0.0 heroku-postbuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.GU88T/_logs/2021-07-02T10_17_10_446Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
if it is heroku postbuild issue then first run
npm run build
in your local system inside client folder(frontend application), it will throw an error if some dependency is missing inside your react app,
if build command is successful only then delete node_modules and package-lock.json file and then run
npm install

Build fails with "host key verification failed" while installing node_modules

UPDATE Clearing my build cache and deploying with no package-lock.json at all fixed.
Deploying my Node app to Heroku has started failing with Host key verification failed at installation of one of my dependencies, a public repository:
-----> Monorepo app detected
Copied /server to root of app successfully
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=DEVELOPMENT
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): 10.x
engines.npm (package.json): unspecified (use default)
Resolving node version 10.x...
Downloading and installing node 10.22.1...
Using default npm version: 6.14.6
-----> Restoring cache
- node_modules
-----> Installing dependencies
Installing node modules
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git#github.com/ethereumjs/ethereumjs-abi.git
npm ERR!
npm ERR! Host key verification failed.
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.RchR7/_logs/2020-10-25T17_11_28_328Z-debug.log
-----> Build failed
There's been no change to my buildpacks, which were working before:
1. https://github.com/lstoll/heroku-buildpack-monorepo
2. https://github.com/heroku/heroku-buildpack-nodejs
App has been running on Heroku for weeks, using the packages that ethereumjs-abi is a dependency of. (It isn't a direct dependency of my app.)
ethereumjs-abi hasn't updated since I started using it
App still runs correctly locally
My own repo is private, but the package repo is public.
I changed my SSH keys recently, but since adding them to GitHub haven't had any other SSH issues. I've now added the new key to Heroku with heroku keys:add and it had no effect.
Previously I was specifying engines: { node: 10.x }, but have now also tried 12.x and 14.x
Pushing from local master to Heroku master
Yeah a few days wasted so far...
Faced with the same issue when replaced npm package with my own fork and provided custom link on github.com.
What helped:
remove package-lock from GIT
clear cache with heroku builds:cache:purge --app $HEROKU_APP_NAME --confirm $HEROKU_APP_NAME

Declaration errors when depyoing TypeScript to Heroku

I'm trying to deploy my TypeScript API to Heroku. I have a heroku-prebuild script running npm i && npm i -g typescript && npm run build and a build script running tsc.
So I had installed some new packages with their corresponding types decalrations, and got errors from Heroku:
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): 12.x
engines.npm (package.json): unspecified (use default)
Resolving node version 12.x...
Downloading and installing node 12.18.4...
Using default npm version: 6.14.6
-----> Restoring cache
- node_modules
-----> Prebuild
Running heroku-prebuild
> swooosh-api#1.0.0 heroku-prebuild /tmp/build_fc3ad6d3
> npm i && npm i -g typescript && npm run build
audited 237 packages in 2.088s
12 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
/tmp/build_fc3ad6d3/.heroku/node/bin/tsc -> /tmp/build_fc3ad6d3/.heroku/node/lib/node_modules/typescript/bin/tsc
/tmp/build_fc3ad6d3/.heroku/node/bin/tsserver -> /tmp/build_fc3ad6d3/.heroku/node/lib/node_modules/typescript/bin/tsserver
+ typescript#4.0.3
added 1 package from 1 contributor in 1.843s
> swooosh-api#1.0.0 build /tmp/build_fc3ad6d3
> tsc
api/utils/config.ts(1,23): error TS7016: Could not find a declaration file for module 'express-rate-limit'. '/tmp/build_fc3ad6d3/node_modules/express-rate-limit/lib/express-rate-limit.js' implicitly has an 'any' type.
Try `npm install #types/express-rate-limit` if it exists or add a new declaration (.d.ts) file containing `declare module 'express-rate-limit';`
api/utils/config.ts(2,22): error TS7016: Could not find a declaration file for module 'express-slow-down'. '/tmp/build_fc3ad6d3/node_modules/express-slow-down/lib/express-slow-down.js' implicitly has an 'any' type.
Try `npm install #types/express-slow-down` if it exists or add a new declaration (.d.ts) file containing `declare module 'express-slow-down';`
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! swooosh-api#1.0.0 build: `tsc`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the swooosh-api#1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.saClh/_logs/2020-10-04T13_30_28_587Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! swooosh-api#1.0.0 heroku-prebuild: `npm i && npm i -g typescript && npm run build`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the swooosh-api#1.0.0 heroku-prebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.saClh/_logs/2020-10-04T13_30_28_605Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
I thought the problem was that Heroku caches the node_modules folder. But I turned that off and I had declaration errors for every single packages...
GitHub repo here
How can I fix this?

Second Node App Deploy on Heroku always Fails

Im experiencing a weird issue with Heroku when deploying.
My second deploy (after committing new github changes and pushing them to my app) always seems to crash with the same error message, however, if I create a new Heroku app and deploy it there, it will always deploy successfully.
This is the error that I receive when the build fails.
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 8.x...
Downloading and installing node 8.9.4...
Using default npm version: 5.6.0
-----> Restoring cache
Loading 2 from cacheDirectories (default):
- node_modules
- bower_components (not cached - skipping)
-----> Building dependencies
Installing node modules (package.json + package-lock)
npm ERR! path /tmp/build_ab6facc2006ab24a04683a1ab7266974/bothello-Bothello-Faq-v2-Demo-e5f231b/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/mkdirp/node_modules/minimist
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/tmp/build_ab6facc2006ab24a04683a1ab7266974/bothello-Bothello-Faq-v2-Demo-e5f231b/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/mkdirp/node_modules/minimist' -> '/tmp/build_ab6facc2006ab24a04683a1ab7266974/bothello-Bothello-Faq-v2-Demo-e5f231b/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/mkdirp/node_modules/.minimist.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /app/.npm/_logs/2018-01-06T05_06_42_422Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Some possible problems:
- Node version not specified in package.json
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
Im a bit stuck here on what to do. Any help would be great.
Cheers,
J
To anyone interested, I fixed this by disabling the Node Modules Cache via the Heroku CLI:
heroku config:set NODE_MODULES_CACHE=false --app app_name
This has fixed the build issue.

Resources