AWS Beanstalk Install Private Github Module via NPM Results In Authentication Issue - node.js

I need to install a private github module via npm on an AWS Beanstalk instance.
I'm using a Github personal access token to authenticate with github and access the repo.
My package.json lists the dependency like this:
"privatepackage": "git+https://jaf91ja9jasflkjasf98109asf10asdf:x-oauth-basic#github.com/user123/privatepackage.git"
However, on Beanstalk I get the following error when deploying:
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! code 128
npm ERR! Command failed: git clone --template=/tmp/.npm/_git-remotes/_templates --mirror git#github.com...
npm ERR! Cloning into bare repository '/tmp/.npm/_git-remotes/git-github-com...
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.

I think you are missing ssh key on your machine and adding same on github.
Please look into generating-ssh-keys which might helps you to resolve this issue.

Related

Issue with git dependency on node version upgrade

I am running a VUE.JS app in a Docker container. The app is currently using node 14.19.0, but I tried upgrading the version to node 15/16.
After changing the node version in the Dockerfile and updating some of the devDependencies, I get an NPM error:
npm ERR! npm ERR! An unknown git error occurred
npm ERR! npm ERR! command git --no-replace-objects ls-remote ssh://git#github.com/[NAMESPACE_PLACEHOLDER]/[REPO_PLACEHOLDER].git
npm ERR! npm ERR! Warning: Permanently added 'github.com' (ECDSA) to the list of known hosts.
npm ERR! npm ERR! git#github.com: Permission denied (publickey).
npm ERR! npm ERR! fatal: Could not read from remote repository.
npm ERR! npm ERR!
npm ERR! npm ERR! Please make sure you have the correct access rights
npm ERR! npm ERR! and the repository exists.
In my package.json file, the repo is loaded with https, not ssh:
"package-name-placeholder": "https://github.com/[NAMESPACE_PLACEHOLDER]/[REPO_PLACEHOLDER].git#v0.1.15"
This exact method is working with Node 14.19.0. I read that there might be an issue with trailing slashes. I tried using them, but the error persists.
Have anyone managed to do something about a similar issue?
Thanks.
Try in your Dockerfile a:
RUN git config --global url."https://${GIT_ACCESS_TOKEN}#github.com".insteadOf "ssh://git#github.com"
(If those repositories are public, you do not need the ${GIT_ACCESS_TOKEN}# part: it would be an ARG GIT_ACCESS_TOKEN passed with a docker build --build-arg GIT_ACCESS_TOKEN=xxx)
You can see here this was reported before:
npm version change in alpine-16's image, and I'm pretty sure that this problem is related to npm version.

Firebase cloud functions deployment issue when using Github package as npm node module

I'm using github repo tag as npm module in my Firebae cloud functions project and it's working fine in local env.
//package.json
"#instantish/martian": "github:Rakmo33/martian#v2.3.0",
However, when I deploy to Firebase cloud functions it throws following error:
"Build failed: npm ERR! Error while executing:\nnpm ERR! /usr/bin/git ls-remote -h -t ssh://git#github.com/Rakmo33/martian.git\nnpm ERR! \nnpm ERR!
Host key verification failed.\nnpm ERR! fatal: Could not read from remote repository.\nnpm ERR! \nnpm ERR!
Please make sure you have the correct access rights\nnpm ERR! and the repository exists.\nnpm ERR! \nnpm ERR! exited with error code: 128\n\nnpm ERR!
A complete log of this run can be found in:\nnpm ERR! /www-data-home/.npm/_logs/2021-11-25T10_28_13_554Z-debug.log; Error ID: beaf8772"
Don't know the details of your project, but the fact is if you had executed:
npm install git+https://git#github.com/Rakmo33/martian.git#v2.3.0
you would have something like this within your package.json:
"dependencies": {
"#rakmo33/martian_fork": "git+https://git#github.com/Rakmo33/martian.git#v2.3.0"
}
and you'd have avoided the necessity of using any password-protected SSH keys.

Permissions error when trying to install jquery-ui/data

Trying to use React-gridstack on a create-react-app and every time I run the command:
npm i jquery-ui/data
when it asks me to, I get this error:
npm ERR! command failed
npm ERR! command git --no-replace-objects ls-remote ssh://git#github.com/jquery-ui/data.git
npm ERR! Warning: Permanently added 'github.com' (RSA) to the list of known hosts.
npm ERR! git#github.com: Permission denied (publickey).
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! Please make sure you have the correct access rights
npm ERR! and the repository exists.
That error is telling you that you either don't have permission to access the repository, this might occur if you're attempting to install a package from a private repository, or that the package you are trying to install does not exist.
In your case the latter is most likely the cause, I assume what you actually want is:
npm i jquery-ui

How can I deploy my meteor app to digital ocean?

I am building an app on the Meteor platform, and my app repository is saved on Github. My server is Digital Ocean. I am trying to deploy commits made in Github to my remote server (website) without success. I tried three approaches, outlined below:
1. I tried executing "git pull" in SSH, but after receiving the message " * branch HEAD -> FETCH_HEAD Already up-to-date" the website remained unchanged.
2. I tried running "mupx", which many recommend for use with Meteor, but I received an error message "Verifying deployment: FAILED".
x Verifying deployment: FAILED
-----------------------------------STDERR-----------------------------------
npm#2, which has some small
npm WARN deprecated backwards-incompatible changes made to `npm run-script` and
npm WARN deprecated semver behavior.
npm ERR! install Couldn't read dependencies
npm ERR! Failed to parse json
npm ERR! Unexpected end of input
npm ERR! File: /bundle/bundle/programs/server/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
npm ERR! System Linux 3.13.0-43-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "i"
npm ERR! cwd /bundle/bundle/programs/server
npm ERR! node -v v0.10.43
npm ERR! npm -v 1.4.29
npm ERR! file /bundle/bundle/programs/server/package.json
npm ERR! code EJSONPARSE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /bundle/bundle/programs/server/npm-debug.log
npm ERR! not ok code 0
=> Redeploying previous version of the app
-----------------------------------STDOUT-----------------------------------
To see more logs type 'mup logs --tail=50'
----------------------------------------------------------------------------
3. I even tried doing "git pull" directly into the Digital Ocean server terminal, but once again received the message " * branch HEAD -> FETCH_HEAD, Already up-to-date. ", once again without any updates to the website.
Does anyone know what I may be doing wrong?
Thank you for your time!

Can't install any packages in Node.js using "npm install"

I'm new to Node.js, and I'm going through a few tutorials.
For some reason, I can't install any new node modules.
I am using:
Mac OSX 10.7.4,
Node v. 0.8.6,
NPM v. 1.1.48.
I run npm install X and I always get a
npm ERR! fetch failed https://registry.npmjs.org/-/X
npm ERR! Error: 404 Not Found
When I actually go to the npmjs registry, I can see the project page, but no matter which tarball link I hit, it's always the same:
{
"error": "not_found",
"reason": "document not found"
}
For example, I tried installing fs by running npm install fs and I get:
npm http GET https://registry.npmjs.org/fs
npm http 200 https://registry.npmjs.org/fs
npm http GET https://registry.npmjs.org/-/fs-0.0.0.tgz
npm http 404 https://registry.npmjs.org/-/fs-0.0.0.tgz
npm ERR! fetch failed https://registry.npmjs.org/-/fs-0.0.0.tgz
npm ERR! Error: 404 Not Found
npm ERR! at null.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/fetch.js:47:16)
npm ERR! at EventEmitter.emit (events.js:115:20)
npm ERR! at WriteStream.flush (fs.js:1514:12)
npm ERR! at fs.close (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:92:5)
npm ERR! at Object.oncomplete (fs.js:297:15)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Darwin 11.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "fs"
npm ERR! cwd /Users/comocomo/Documents/workspace/nodeTest
npm ERR! node -v v0.8.6
npm ERR! npm -v 1.1.48
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/comocomo/Documents/workspace/nodeTest/npm-debug.log
npm ERR! not ok code 0
I tried fs, fs-extra, express, and formidable, all giving me the same 404 response.
There must be something wrong on my part, I'm pretty sure the whole registry is not broken.
Am I using an old registry? Should I change it in my config file? I honestly would rather not start installing things manually, and I'm sure it's just a small configuration issue.
Thanks!
I found the there is a certificate expired issue with:
npm set registry https://registry.npmjs.org/
So I made it http, not https :-
npm set registry http://registry.npmjs.org/
And have no problems so far.
The repository is not down, it looks like they've changed how they host files (I guess they have restored some old code):
Now you have to add the /package-name/ before the -
Eg:
http://registry.npmjs.org/-/npm-1.1.48.tgz
http://registry.npmjs.org/npm/-/npm-1.1.48.tgz
There are 3 ways to solve it:
Use a complete mirror:
Use a public proxy:
--registry http://165.225.128.50:8000
Host a local proxy:
https://github.com/hughsk/npm-quickfix
git clone https://github.com/hughsk/npm-quickfix.git
cd npm-quickfix
npm set registry http://localhost:8080/
node index.js
I'd personally go with number 3 and revert to npm set registry http://registry.npmjs.org/ as soon as this get resolved.
Stay tuned here for more info: https://github.com/isaacs/npm/issues/2694
Npm repository is currently down.
See issue #2694 on npm github
EDIT:
To use a mirror in the meanwhile:
npm set registry http://ec2-46-137-149-160.eu-west-1.compute.amazonaws.com
you can reset this later with:
npm set registry https://registry.npmjs.org/
source
This error might also occur due to proxy settings, once check that your proxy allow the access to npm commands.
It worked for me quite well.
npm set registry http://85.10.209.91/
(this proxy fetches the original data from registry.npmjs.org and manipulates the tarball urls to fix the tarball file structure issue).
The other solutions seem to have outdated versions.
If you happened to run npm install command on Windows, first make sure you open your command prompt with Administration Privileges. That's what solved the issue for me.
Check under security settings
Allow Apps Downloaded from:
App Store and other identified developers
This was one of the reasons I faced recently.

Resources