Heroku Deployment Error: npm ERR! Host key verification failed. NextJS/ExpressJS App - express

I am attempting to deploy my Next.js/Express,js backend app to Heroku via GitHub, however, I keep receiving the following error:
If anyone can please help me resolve this issue, that would be highly appreciated!
Thanks.
-----> Building on the Heroku-20 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 14.x...
Downloading and installing node 14.17.5...
Using default npm version: 6.14.14
-----> Installing dependencies
Installing node modules
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git#github.com/securedeveloper/js-xlsx.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.ScCS4/_logs/2021-08-22T17_21_36_340Z-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

I don't know if this is a good solution, but after removing package-lock.json and pushing again the error disappeared

Related

nextjs Build failed because of webpack errors on CentOS 7

I want to deploy a nextjs application on a centos server. But when i try to build using npm run build it gives me the following error
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist#latest --update-db
info - Creating an optimized production build
Failed to compile.
ModuleNotFoundError: Module not found: Error: Can't resolve '../context/auth/AuthState' in '/var/www/html/projectname/pages'
> Build error occurred
Error: > Build failed because of webpack errors
at build (/var/www/html/projectname/node_modules/next/dist/build/index.js:15:918)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client-ubii-app#0.1.0 build: `next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client-ubii-app#0.1.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! /root/.npm/_logs/2021-03-31T21_10_01_066Z-debug.log
But when i do the same on my local machine runnig windows 10 it works fine
If you has been change in name of file or folder only case sensitive character, this problem may be happen if your remote branch is not updated. Please, make sure if remote branch has the old name of file or folder. If true, fix it because the CentOs is Linux, so file and folder with same words in lower case is different with upper case.

Problems deploying to IBM Cloud

I created a web app in NodeJS which uses Tensorflow to get a prediction from a model trained in Python. What I'm trying to do is deploy that through IBM Cloud's Cloud Foundry SDK for NodeJS. The problem I'm running into is when I'm trying to push my project to IBM Cloud. From looking at the logs in the console it seems that TensorflowJS Node when it's installing and runs
node-gyp rebuild
it causes some issues. For some reason it runs into an error when that's running which is
/temp/app/node_modules/#tensorflow/tfjs-node/deps/tensorflow/lib/libtensorflow.so: file not recognized: File format not recognized
and from there it causes a long chain of errors. Anyone know how I can fix this?
Here is are the command line logs.
Downloaded build artifacts cache (484.1K)
Staging...
-----> IBM SDK for Node.js Buildpack v3.21-20180628-1258
Based on Cloud Foundry Node.js Buildpack v1.5.24
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version (latest stable) via 'node-version-resolver'
Installing IBM SDK for Node.js (6.14.3) from cache
Using default npm version: 3.10.10
-----> Restoring cache
Loading 2 from cacheDirectories (default):
- node_modules (exists - skipping)
- bower_components (not cached - skipping)
-----> Checking and configuring service extensions before installing
dependencies
-----> Building dependencies
Prebuild detected (node_modules already exists)
Rebuilding any native modules
> protobufjs#6.8.8 postinstall /tmp/app/node_modules/protobufjs
> node scripts/postinstall
> #tensorflow/tfjs-node#0.1.9 install
/tmp/app/node_modules/#tensorflow/tfjs-node
> node-gyp rebuild
make: Entering directory `/tmp/app/node_modules/#tensorflow/tfjs-
node/build'
ACTION binding_gyp_tfjs_binding_target_download_libtensorflow
Release/libtensorflow.so
CXX(target) Release/obj.target/tfjs_binding/binding/tfe_utils.o
CXX(target) Release/obj.target/tfjs_binding/binding/tfjs_backend.o
CXX(target) Release/obj.target/tfjs_binding/binding/tfjs_binding.o
SOLINK_MODULE(target) Release/obj.target/tfjs_binding.node
/tmp/app/node_modules/#tensorflow/tfjs-
node/deps/tensorflow/lib/libtensorflow.so: file not recognized: File
format
not recognized
collect2: error: ld returned 1 exit status
make: *** [Release/obj.target/tfjs_binding.node] Error 1
make: Leaving directory `/tmp/app/node_modules/#tensorflow/tfjs-
node/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit
(/tmp/app/vendor/node/lib/node_modules/npm/node_modules/node-
gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit
(internal/child_process.js:219:12)
gyp ERR! System Linux 4.4.0-109-generic
gyp ERR! command "/tmp/app/vendor/node/bin/node"
"/tmp/app/vendor/node/lib/node_modules/npm/node_modules/node-
gyp/bin/node- gyp.js" "rebuild"
gyp ERR! cwd /tmp/app/node_modules/#tensorflow/tfjs-node
gyp ERR! node -v v6.14.3
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Failed at the #tensorflow/tfjs-node#0.1.9 install script
'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm
installed.
npm ERR! node-gyp rebuild
npm ERR! Linux 4.4.0-109-generic
npm ERR! argv "/tmp/app/vendor/node/bin/node"
"/tmp/app/vendor/node/bin/npm" "rebuild" "--
nodedir=/tmp/app/vendor/node"
npm ERR! node v6.14.3
npm ERR! npm v3.10.10
npm ERR! #tensorflow/tfjs-node#0.1.9 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! If you do, this is most likely a problem with the
#tensorflow/tfjs-node package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! You can get information on how to open an issue for this
project with:
npm ERR! npm bugs #tensorflow/tfjs-node
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls #tensorflow/tfjs-node
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support
request:
npm ERR! /tmp/app/npm-debug.log
-----> Build failed
Some possible problems:
- node_modules checked into source control
http://docs.cloudfoundry.org/buildpacks/node/node-tips.html
- Node version not specified in package.json
http://docs.cloudfoundry.org/buildpacks/node/node-tips.html
Failed to compile droplet: Failed to compile droplet: exit status 1
Exit status 223
Staging failed: STG: Exited with status 223
Stopping instance 4e1dd2ee-71b4-4f84-95e8-c5f6c7bd24e0
Destroying container
Error staging application: App staging failed in the buildpack compile
phase
FAILED
It is a problem related to the version of NodeJs installed on your cloud environment. The errors shows that the version of NodeJs being used is Node.js (6.14.3) whereas tensorflowJs requires Node V8+
For some reason if I remove the node_modules folder from the working directory and then try to push to IBM Cloud it works. My guess is probably because when Tensorflow installs it installs certain files depending on your operating system and in my case
libtensorflow.so
was one of those files.

How to add public bitbucket repo in package.json or bower.json

I have a library pushed on bitbucket as public repo. I want its link to used in package.json dependencies object. I have tried various https formats but not one is working.
"library_name": "https://username#bitbucket.org/repo_name.git"
"library_name": bitbucket://bitbucket.com/username/repo_name.git
"library_name": "bitbucket#bitbucket.com:username/repo_name.git#master
Or I can add it in bower.json? I don't want to use it directly like npm install repo_url
The error I get is something like
ECMDERR Failed to execute "git ls-remote --tags --heads https://username#bitbucket.org/dv.keystone.git", exit code of #128 remote: Not Found fatal: unable to access 'https://username#bitbucket.org/reponame.git/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.
remote: Not Found
fatal: unable to access 'https://username#bitbucket.org/repo_name.git/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.
Update:
"lib_name": "https://username#bitbucket.org/team_name/repo_name.git"
It works in bower.json but I need this in package.json to work. If I use it in package.json, it gives this error
npm ERR! addLocal Could not install /tmp/npm-16628-b0121d64/git-cache-cbc9eb1e/7c4c6a5fb3e77723f3866c99fdf0825ba7cc0c5c
npm ERR! Linux 4.13.0-39-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v6.12.3
npm ERR! npm v3.10.10
npm ERR! code EISDIR
npm ERR! errno -21
npm ERR! syscall read
npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.
Did some googling for you - as I wasn't sure myself.
This may work for you:
git+https://bitbucket.org/{user}/{repo}.git
I do not know how to add BitBucket modules in package.json. The way I do add github repo as,
"library-name": "git+https://github.com/user/library-name.git"
So to think about just replacing the github part it should be
"library-name": "git+https://bitbucket.org/user/library-name.git"

npm install host key verification failed

I ran npm install in angular2+ project directory and got below error which I cannot understand at all.
npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\bin\git.EXE ls-remote -h -t ssh://git#bitbucket.org/path/projectname.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
I have created ssh key on bitbucket and account and saved it on drive. |
I have clone project from bitbucket.
What does this error has to do with that?
As I am new on project so don't have much knowledge.
Do I need to provide ssh key while npm install as well?
Please let me know if I can provide more info related to question.
Thanks!
Please check the npm version that you are using. Npm comes bundled with node and you shouldn't have multiple instances on your classpath.
Hey yup, I thought as much, but seeing as I had updated npm to the
latest version ( I even uninstalled node and reinstalled ) with the
same result. npm -v still showed the same version - 1.4.9.
FYI for others that may have the same issue. I also have Chocolatey
installed, and it seems that npm was also installed via Chocolately
which seems to overide the npm path. Uninstalling npm from Chocolately
resolved the npm version issue.
After that angular/cli installs correctly from npm.
https://github.com/angular/angular-cli/issues/6313#issuecomment-301360623

Error when yarn add and npm i

Good evening!
i'm trying to add some packages to my native react application but it's not working with either npm or yarn. i have uninstalled and reinstalled yarn but it has not changed anything
I use Windows 10.
for yarn :
yarn add react-navigation
yarn add v1.5.1
[1/4] Resolving packages...
error An unexpected error occurred: "Couldn't find the binary git".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\Boubacar\\Desktop\\blob\\essai\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
for npm :
npm i react-navigation
npm ERR! code ENOGIT
npm ERR! No git binary found in $PATH
npm ERR!
npm ERR! Failed using git.
npm ERR! Please check if you have git installed and in your PATH.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Boubacar\AppData\Roaming\npm-cache\_logs\2018-04-08T00_02_28_158Z-debug.log.
Help me please!
The console log is plain and clear.
error An unexpected error occurred: "Couldn't find the binary git".
Check/Install Git on your system.
For Windows users, need to set environment path, like
C:\Program Files\Git\cmd