While pushing my commits to heroku, "code ETARGET notarget No matching version found for mongodb#0.7.9" - npm-install

I built a localhost website on MacOS using Express, Mongodb. Now I want to deploy it to Heroku server. Here are the commands I used before running into an error
$ git add .
$ git commit -m"Some ms"
$ git push origin master
$ heroku create
$ git push heroku master
The error when I push to heroku is
Enumerating objects: 1695, done.
Counting objects: 100% (1695/1695), done.
Delta compression using up to 4 threads
Compressing objects: 100% (1332/1332), done.
Writing objects: 100% (1695/1695), 5.41 MiB | 720.00 KiB/s, done.
Total 1695 (delta 330), reused 1420 (delta 288)
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 10.x...
remote: Downloading and installing node 10.16.2...
remote: Using default npm version: 6.9.0
remote:
remote: -----> Installing dependencies
remote: Prebuild detected (node_modules already exists)
remote: Rebuilding any native modules
remote: body-parser#1.19.0 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/body-parser
remote: bytes#3.1.0 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/bytes
remote: content-type#1.0.4 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/content-type
remote: debug#2.6.9 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/debug
remote: ms#2.0.0 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/ms
remote: depd#1.1.2 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/depd
remote: http-errors#1.7.2 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/http-errors
remote: inherits#2.0.3 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/inherits
remote: setprototypeof#1.1.1 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/setprototypeof
remote: statuses#1.5.0 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/statuses
remote: toidentifier#1.0.0 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/toidentifier
remote: iconv-lite#0.4.24 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/iconv-lite
remote: safer-buffer#2.1.2 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/safer-buffer
.....
remote: mongodb#2.2.36 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/mongodb
remote: mongodb-core#2.1.20 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/mongodb-core
remote: moongoose#0.0.5 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/moongoose
remote: ajv#4.11.8 /tmp/build_95881850077fddd90b5770d9bd5b3b7a/node_modules/moongoose/node_modules/ajv
remote: Installing any new modules (package.json)
remote: npm ERR! code ETARGET
remote: npm ERR! notarget No matching version found for mongodb#0.7.9
remote: npm ERR! notarget In most cases you or one of your dependencies are requesting
remote: npm ERR! notarget a package version that doesn't exist.
remote: npm ERR! notarget
remote: npm ERR! notarget It was specified as a dependency of 'mongoose'
remote: npm ERR! notarget
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.VeHSV/_logs/2019-08-09T16_20_21_378Z-debug.log
remote:
remote: -----> Build failed
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to hidden-savannah-22467.
remote:
To https://git.heroku.com/hidden-savannah-22467.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/hidden-savannah-22467.git'
I have tried $ npm cache clean --force, $ npm install and $ npm install mongoose --save and $ npm install mongodb --save and I got this error
npm ERR! code ETARGET
npm ERR! notarget No matching version found for mongodb#0.7.9
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'mongoose'
npm ERR! notarget
My package.json file is
{
"name": "yelp",
"version": "1.0.0",
"description": "Clone of Yelp",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js"
},
"dependencies": {
"body-parser": "^1.19.0",
"connect-flash": "^0.1.1",
"ejs": "^2.6.2",
"express": "^4.17.1",
"express-session": "^1.16.2",
"method-override": "^3.0.0",
"mongodb": "^3.3.0-beta2",
"mongoose": "0.0.5",
"passport": "^0.4.0",
"passport-local": "^1.0.0",
"passport-local-mongoose": "^5.0.1",
"request": "^2.88.0"
}
}
Can anyone help me installing mongoose and deploying to Heroku please?

I fixed this error by changing the version of mongoose from 0.0.5 to ^4.1.12 in package.json. I got the version 0.0.5 when I did $npm install mongoose --save in terminal. I wonder why I got such version when using that command?

Related

! [remote rejected] new-branch -> main (pre-receive hook declined) error: failed to push some refs to Heroku

I am running into an issue while trying to push up to Heroku. I can't seem to find a working solution. Please help. I have tried adding NPM and Node versions in my package.json as well as psuhing from a new branch -- new-branch:main.
Nothing seems to work. Help would be appreciated. Thanks in advance.
Total 0 (delta 0), reused 0 (delta 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_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.x
remote: engines.npm (package.json): 8.x
remote:
remote: Resolving node version 16.x...
remote: Downloading and installing node 16.16.0...
remote: Bootstrapping npm 8.x (replacing 8.11.0)...
remote: npm 8.13.2 installed
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote:
remote: > openmenu#1.2.1 install
remote: > npm --prefix backend install backend && npm --prefix frontend install frontend
remote:
remote: npm ERR! code ENOENT
remote: npm ERR! syscall open
remote: npm ERR! path /tmp/build_4492b4f5/backend/package.json
remote: npm ERR! errno -2
remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_4492b4f5/backend/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.oFKZI/_logs/2022-07-08T01_43_06_983Z-debug-0.log
remote: npm ERR! code 254
remote: npm ERR! path /tmp/build_4492b4f5
remote: npm ERR! command failed
remote: npm ERR! command sh -c /tmp/install657244586683.sh
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.oFKZI/_logs/2022-07-08T01_43_04_790Z-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: 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 openmenu-live.
remote:
To https://git.heroku.com/openmenu-live.git
! [remote rejected] new-branch -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/openmenu-live.git'

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

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

Gatsby new fails to install the sharp package and breaks

I can't initiate a gatsby starter project. The new command process breaks down during initialization, and results in an error and non-compilable project.
Here's the command:
> gatsby new gatsby-test
The follwing process starts, failing when during npm install when the sharp package is attempting to install.
info Creating new site from git:
Cloning into 'gatsby-test'...
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 2309 (delta 4), reused 10 (delta 4), pack-reused 2299
Receiving objects: 100% (2309/2309), 12.62 MiB | 7.98 MiB/s, done.
Resolving deltas: 100% (1487/1487), done.
success Created starter directory layout
info Installing packages...
> sharp#0.23.2 install /home/developer/projects/gatsby-test/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.8.1/libvips-8.8.1-linux-x64.tar.gz
fs.js:114
throw err;
^
Error: EACCES: permission denied, copyfile '/tmp/1890-libvips-8.8.1-linux-x64.tar.gz' -> '/home/developer/.npm/_libvips/libvips-8.8.1-linux-x64.tar.gz'
at Object.copyFileSync (fs.js:1728:3)
at WriteStream.<anonymous> (/home/developer/projects/gatsby-test/node_modules/sharp/install/libvips.js:104:16)
at WriteStream.emit (events.js:198:13)
at lazyFs.close (internal/fs/streams.js:207:14)
at FSReqWrap.args [as oncomplete] (fs.js:140:20)
make: Entering directory '/home/developer/projects/gatsby-test/node_modules/sharp/build'
TOUCH Release/obj.target/libvips-cpp.stamp
CXX(target) Release/obj.target/sharp/src/common.o
In file included from ../src/common.cc:25:0:
/usr/include/vips/vips8:35:10: fatal error: glib-object.h: No such file or directory
#include <glib-object.h>
^~~~~~~~~~~~~~~
compilation terminated.
sharp.target.mk:129: recipe for target 'Release/obj.target/sharp/src/common.o' failed
make: *** [Release/obj.target/sharp/src/common.o] Error 1
make: Leaving directory '/home/developer/projects/gatsby-test/node_modules/sharp/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 4.15.0-70-generic
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/developer/projects/gatsby-test/node_modules/sharp
gyp ERR! node -v v10.17.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp#0.23.2 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp#0.23.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! /home/developer/.npm/_logs/2019-11-18T16_45_16_026Z-debug.log
ERROR
Command failed with exit code 1: npm install
Error: Command failed with exit code 1: npm install
- error.js:56 makeError
[lib]/[gatsby-cli]/[execa]/lib/error.js:56:11
- index.js:114 handlePromise
[lib]/[gatsby-cli]/[execa]/index.js:114:26
- next_tick.js:68 process._tickCallback
internal/process/next_tick.js:68:7
Any idea what's going on here? I saw there were some problems with sharp in the past but that is supposed to be a closed and fixed issue now. What am I missing here?
You can fix this by running the below in your terminal...
rm -rf /Users/{username}/.npm/_libvips
brew install vips
rm -rf node_modules
npm install
The following line:
Error: EACCES: permission denied, copyfile '/tmp/1890-libvips-8.8.1-linux-x64.tar.gz' -> '/home/developer/.npm/_libvips/libvips-8.8.1-linux-x64.tar.gz'
suggests you have a permissions error moving tmp file to your users local .npm directory. Hard to tell why this is without knowing more context about which user ran the command, etc.
The following line:
fatal error: glib-object.h: No such file or directory
suggests you don't have sharp or vips correctly installed.
npm install sharp
For Ubuntu:
sudo apt-get install -y libvips-tools
For mac:
brew update vips
For archlinux/manjaro:
sudo pacman -S libvips
I had the same issue. I solved it by downloading the package manually and pasting in
download the libvips from https://github.com/lovell/sharp-libvips/releases/download/v8.8.1/libvips-8.8.1-linux-x64.tar.gz
copy the lib into .npm folder
sudo cp libvips-8.8.1-linux-x64.tar.gz /home/[YOURNAME]/.npm/_libvips/
remove your broken gatsby-test folder
run
gatsby new gatsby-test
again
To fix this, I ran:
rm -rf node_modules
yarn cache clean
yarn add --dev yarn-upgrade-all
npx yarn-upgrade-all
Then, I re-installed all necessary packages removed from package.json when I ran the command to upgrade all packages.
Afterwards, I ran gatsby build and gatsby develop
Try the sudo command. If you're happy with applying root perms to the install.

Error: Cannot find module '#angular/tsc-wrapped/src/tsc' ionicjs ionic view

I get following error when try to compile ionic 3 app with ionic-view (www.ionicjs.com)
Error: Cannot find module '#angular/tsc-wrapped/src/tsc'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object. (/usr/src/app/node_modules/#ionic/app-scripts/dist/aot/aot-compiler.js:7:13)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
npm info lifecycle MedMan#0.0.1~build: Failed to exec build script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! MedMan#0.0.1 build: `ionic-app-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the MedMan#0.0.1 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! /home/gitlab-runner/.npm/_logs/2017-09-25T14_14_22_583Z-debug.log
/snapshot.sh: line 32: [: missing `]'
npm run build failed
Make sure your project has a build script in the package.json
Failed to upload build to storage please retry your build.
Running after script...
$ clean-up
Cleaning up files...
Successful clean up
ERROR: Job failed: exit status 1
I work with following Versions:
"#angular/tsc-wrapped": "4.4.3",
"#ionic/cli-plugin-ionic-angular": "1.4.1"
"ionic": "3.12.0",
"rxjs": "^5.4.3",
"tslint": "^5.7.0",
"tslint-loader": "^3.5.3"
npm v 4.6.1
node v 8.5.0
None of the solutions at the web can solve this issue for me.
I guess this should fix it:
upgrade npm to the latest version (5.3.0), I personally stayed at 5.1.0 because there were issues with ionic and version 5.2.0 but I think it is fixed in the current version
rm -rf node_modules package-lock.json (on Windows: delete node_modules and package-lock.json manually)
npm install
If it still does not work you can try to manually install tsc-wrapped:
npm install --save-dev #angular/tsc-wrapped
Try this:
npm install npm#latest -g
npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli#latest
npm install #angular/tsc-wrapped autoprefixer
https://github.com/angular/angular-cli/issues/3183#issuecomment-261740427
I additionally had to (but dont think this is only related to my case):
npm rebuild node-sass

How to Fix "npm ERR! addLocal Could not install"

I'm getting this error when attempting to push my Phoenix application to Heroku.
I've been following the guide from the Phoenix framework website.
What is causing this error and how can I fix it?
WARNING: phoenix_static_buildpack.config wasn't found in the app
remote: Using default config from Phoenix static buildpack
remote: Will use the following versions:
remote: * Node 6.9.2
remote: Will export the following config vars:
remote: * Config vars DATABASE_URL
remote: * MIX_ENV=prod
remote:
remote: -----> Installing binaries
remote: Downloading node 6.9.2...
remote: Installing Node 6.9.2...
remote: Using default npm version
remote:
remote: -----> Building dependencies
remote: Installing and caching node modules
remote: npm ERR! addLocal Could not install /tmp/build_23f60aac277eab15b4ce274dcaf9bb16/deps/phoenix
remote: npm ERR! addLocal Could not install /tmp/build_23f60aac277eab15b4ce274dcaf9bb16/deps/phoenix_html
remote: npm ERR! Linux 3.13.0-105-generic
remote: npm ERR! argv "/tmp/build_23f60aac277eab15b4ce274dcaf9bb16/.heroku/node/bin/node" "/tmp/build_23f60aac277eab15b4ce274dcaf9bb16/.heroku/node/bin/npm" "install" "--quiet" "--unsafe-perm" "--userconfig" "/tmp/build_23f60aac277eab15b4ce274dcaf9bb16/npmrc"
remote: npm ERR! node v6.9.2
remote: npm ERR! npm v3.10.9
remote: npm ERR! path /tmp/build_23f60aac277eab15b4ce274dcaf9bb16/deps/phoenix
remote: npm ERR! code ENOENT
remote: npm ERR! errno -2
remote: npm ERR! syscall open
remote:
remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_23f60aac277eab15b4ce274dcaf9bb16/deps/phoenix'
remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_23f60aac277eab15b4ce274dcaf9bb16/deps/phoenix'
remote: npm ERR! enoent This is most likely not a problem with npm itself
remote: npm ERR! enoent and is related to npm not being able to find a file.
remote: npm ERR! enoent
remote:
remote: npm ERR! Please include the following file with any support request:
remote: npm ERR! /tmp/build_23f60aac277eab15b4ce274dcaf9bb16/npm-debug.log
remote: ! Push rejected, failed to compile Phoenix app.
I was having the same issue as you before. Try adding the npm version to the phoenix_static_buildpack.config file
Here's a sample from my app:
phoenix_static_buildpack.config (in the root)
clean_cache=false
compile="compile"
config_vars_to_export=(DATABASE_URL)
node_version=6.9.5
npm=3.10.8
phoenix_relative_path=.
remove_node=false
You can also set the
elixir_buildpack.config (also in the root directory)
erlang_version=18.3
elixir_version=1.4.0
always_rebuild=false
runtime_path=/app