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
Related
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
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.
I am trying to deploy my app in Heroku server to be available in my customized domain name. Everything builds locally, but When I try to deploy in Heroku, the following error pops up. Please help.
This is my build log:
-----> 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): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 12.x...
Downloading and installing node 12.16.3...
Using default npm version: 6.14.4
-----> Restoring cache
Cached directories were not restored due to a change in version of node, npm, yarn or stack
Module installation may take longer for this build
-----> Installing dependencies
Installing node modules
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "[object Object]": Tags may not have any characters that encodeURIComponent encodes.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.vvKxN/_logs/2020-05-23T20_24_41_347Z-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
As the error says, you have not mentioned npm and node version in the package.json file.
"engines": {
"npm": "x",
"node": "y"
}
replace x and y with your version of npm and node.
node -v and npm -v would provide you with your versions.
You have possible problem 'Node version not specified in package.json'. You need to describe what version of node and npm or yarn you have using.
Why is my Node.js build failing because of an invalid semver requirement? might help.
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.
I have a Node.js app running as an Azure Website and doing my deployments using Git. The app requires a module that's private (i.e. written by me, no relevance to anyone else and thus not available in NPM) and common to my other projects. Let's say the module is located in ./lib/mymodule and it has its own dependencies in its package.json file. The problem is I cannot figure out how to have Azure install the dependencies of my own module. I would like to avoid having to add my node_modules directory under version control (currently .gitignor'd) or having to add the module's dependencies as my app's dependencies (which is ugly and a bit inconvenient).
It's trivial to get this working on my local dev environment. The first thing I did was simply include my own module as a local dependency in my package.json as described in https://docs.npmjs.com/files/package.json (see section "Local Paths"). A simple npm install would now install my own module nice and easy. Since I know that Azure runs npm install every time I deploy a new version, I figured this is all I need. Turns out I was wrong: local paths in package.json dependencies section were only introduced in NPM 2.0.0 and Azure is running NPM 1.4.x, so the deployment obviously failed. Ok then, can I run a different version of NPM in Azure? In theory, yes, but practice seems to be something else. I tried out https://github.com/glennblock/azure-node-runtime-selector but to no avail. Here's some of the deployment output:
remote: Handling node.js deployment.
remote: KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot'
remote: ............
remote: node version: 0.11.14
remote: ..............
remote: 2.1.18
remote: npm version: 1.4.6
remote: An error has occured during web site deployment.
remote: npm failed
remote:
remote: Error - Changes committed to remote repository but deployment to website failed.
Apparently it fails to install any NPM version >= 2.0.0.
Ok then, this is not so bad, I figured. I can work with an older version of NPM, I just need to run another npm install to install my own module, as NPM documentation hints. So I took the local dependency away from my package.json and simply run npm install ./lib/mymodule. Nice and easy... on my local. I dug up instructions how to run custom commands on deployment in Azure: just run azure site deploymentscript --node and edit deploy.sh it creates. Just to ensure the custom deployment script works at all, I made one deployment without editing anything. Worked ok. Then I added a line in deploy.sh (around line 111):
# 3. Install npm packages
if [ -e "$DEPLOYMENT_TARGET/package.json" ]; then
cd "$DEPLOYMENT_TARGET"
eval $NPM_CMD install --production
eval $NPM_CMD install ./lib/mymodule #This line added by me
exitWithMessageOnError "npm failed"
cd - > /dev/null
fi
Nope. This is what I get:
remote: Installing npm packages...
remote: npm ERR! addLocal Could not install ./lib/mymodule
remote: An error has occurred during web site deployment.
remote: npm ERR! Error: ENOENT, stat 'd:\home\site\wwwroot\lib\mymodule'
remote: npm failed
...snip...
remote:
remote: npm ERR! System Windows_NT 6.2.9200
remote: npm ERR! command "d:\\Program Files (x86)\\nodejs\\0.10.28\\node.exe" "D:\\Program Files(x86)\\npm\\1.4.9\\node_modules\\npm\\bin\\npm-cli.js" "install" "./lib/mymodule"
remote: npm ERR! cwd d:\home\site\wwwroot
remote: npm ERR! node -v v0.10.28
remote: npm ERR! npm -v 1.4.9
remote: npm ERR! path d:\home\site\wwwroot\lib\mymodule
remote: npm ERR! code ENOENT
remote: npm ERR! errno 34
remote: npm
remote:
remote: Error - Changes committed to remote repository but deployment to website failed.
This is where I got stuck. I tried playing around with the path, guessing that Windows is mangling it somehow, but haven't found a working solution yet. The weird thing is that ./lib/mymodule would seem to resolve to d:\home\site\wwwroot\lib\mymodule which look just fine to me and DOES exist, at least after deployment when I FTP'd in to take a look.
I would appreciate any and all help in either getting NPM 2.x.x working or my making custom deployment go through. Or maybe there's an alternative to managing my local modules I haven't thought of? And if all else fails, maybe I'll just commit my node_modules or manage my dependencies manually. I've already used way too much time to resolve what first seemed like a trivial issue. :)
Azure WebSites team will be shipping support for npm 2.1.17 out-of-the box by end of the month (Jan'15). Hope this will help you unblock you.