Getting permission denied error for a local repo, which I can clone successfully, however getting error for npm install:npm install
npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t ssh://git#stash.company.com:2222/castor/module-name.git
npm ERR!
npm ERR! git#stash.company.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!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\MOEL3\AppData\Roaming\npm-cache\_logs\2018-03-08T18_12_33_006Z-debug.log
However, I have to put my password each time I do a git command regarding the remote repo pull, push etc... would that be the reason? howto solve this problem?
Recently came across this issue, so frustrating...
I could git clone a private repo no problems, but as soon as I tried to npm install a package through Visual Studio Code, it fell over on what looked like an authentication error.
git#github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
What fixed it for me was opening Sublime Text as Administrator, locating the ssh_config file in the C:ProgramFiles/Git/etc/ssh/ folder, opening this in the Admin sublime window, and adding this at the bottom
HOST github.com
IdentityFile /c/Users/me/.ssh/id_rsa
It turned out that npm install was looking in the root folder for my key, not in the home folder. Telling it to take the key from the identity in my user folder solved the issue.
Hope this may help someone else.
Related
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.
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
Hey Guys
I am geting this error when running npm install
openssl config failed: error:02001002:system library:fopen:No such file or directory
openssl config failed: error:02001002:system library:fopen:No such file or directory
npm ERR! Error while executing:
npm ERR! C:\Users\rmittal\AppData\Local\Programs\Git\cmd\git.EXE ls-remote -h -t ssh://git#github.com/xxxx/xxx-api.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! C:\Users\rmittal\AppData\Roaming\npm-cache\_logs\2021-04-02T06_15_51_313Z-debug.log
git#github.com/xxxx/xxx-api.git is my other repo only
I looked into npm install error : "Host key verification failed."
but did not lead me to solution.
Can someone plz help me?
Version used :
D:\>node -v
v10.23.1
D:\>npm -v
openssl config failed: error:02001002:system library:fopen:No such file or directory
openssl config failed: error:02001002:system library:fopen:No such file or directory
6.14.10
Repostiory are also setup properly
A ssh-keyscan -H github.com >> ~/.ssh/known_hosts suggested in the answer you mention should work, but since you are in a CMD, it should be:
ssh-keyscan -H github.com >> %USERPROFILE%/.ssh/known_hosts
Assuming:
your %PATH% includes C:\path\to\Git\usr\bin (where ssh-keyscan.exe resides)
your private key does give you access to that private repository.
Test the last point with (independently of npm), in any folder
git ls-remote git#github.com/xxxx/xxx-api.git
If you can list remote heads from that private repository, that means you do have access to it. And it should ask to add a fingerprint in %USERPROFILE%/.ssh/known_hosts if needed.
Then you can try the npm command again.
So I wanted to help out, and forked a Node-RED module to make some small contribution, but then got lost messing around with how to get Node-RED to run my fork (for testing) rather than the packaged version. Then I learned about npm's ability to install from a Github URL, which is nice, but it wouldn't work because I had already installed the module. Then I found I couldn't uninstall it either
npm uninstall original-module
npm ERR! path /home/nodered/.node-red/node_modules/original-module/package.json
npm ERR! code ELOOP
npm ERR! errno -40
npm ERR! syscall open
npm ERR! ELOOP: too many symbolic links encountered, open '/home/nodered/.node-red/node_modules/original-module/package.json'
so in frustration I deleted the module's directory, only to find myself unable to move forwards, or backwards. npm install https://github.com/me/forkedmodule fails with
npm ERR! code 128
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b master https://github.com/me/forkedmodule.git /root/.npm/_cacache/tmp/git-clone-d31dc53b
npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-d31dc53b': Permission denied
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-08-22T01_07_18_257Z-debug.log
and trying to install the original with npm install original-module fails with
npm ERR! code ENOLOCAL
npm ERR! Could not install from "node_modules/original-module" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-08-22T01_09_56_127Z-debug.log
As you've probably guessed, I'm pretty new to Node.js, Node-RED and npm, but I haven't been able to help myself, so have to ask for help! It seems nonsensical to me that npm appears to be looking for a local copy of the package.json file belonging to the package I'm trying to install?
Edit: I should add that the above commands were all run as root.
Ok, found a solution, not sure if it's the best one though!
In the "project" directory (/home/nodered/.nodered in my case) there's a package-lock.json file which lists the packages used by the project. In there I found an entry for the original-module which I removed, after which I was able to install the package "normally" with npm install original-module.
Then to solve the permission issue when installing from a GitHub URL, I found I needed to impersonate the "nodered" user with su - nodered (it's a password-less user in my case). As "nodered" npm install https://github.com/me/forkedmodule succeeded without any error. A little curious since I was trying to do this as root before, and got a permission error, but there you go. I also took the opportunity to chown -R the project's node_modules directory to nodered:nodered as I could see that was a bit of mess.
In future, I will try to remember to su - to my nodered user first, and navigating to the project root (again, /home/nodered/.node-red in my case) before running npm install anything. Hopefully that will avoid any further issues. Oh and a note to anyone else who just wants to contrib some quick changes to a module hosted on GitHub: to "pull" in changes you simply run npm install https://github.com/me/forkedmodule again - npm doesn't appear to provide any dedicated "update" method.
I had the same issue, in my case the solution was to delete the package-lock.json, delete node_modules, then reinstall npm modules.
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.