Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install of private dependencies does not work but clone does

I have 3 private dependencies in my package.json. When i run npm install i get the errors. PLEASE NOTE THAT WHEN I DO CLONE OF THE SAME THEN IT CLONES ONLY NPM INSTALL DOES NOT WORK

Cloning into bare repository  
Permission denied (publickey). 
fatal: Could not read from remote repository. 
Please make sure you have the correct access rights and the repository exists.

The entire log is present below.

There are few similar issues related but none of them provide a solution in my scenario. Initially i thought it was nodejs and npm version issues so i updated them by running windows nodejs.msi and currently the version is as shown in the image. enter image description here

The contents of my package.json is as below: (most of it is removed, just the important private dependencies are mentioned)

  "dependencies": {
    "private-dep2": "git+ssh://[email protected]:reph/private-dep2.git#v0.3.5"
  },
  "devDependencies": {
    "ember-cli": "0.2.5",
    "ember-cli-app-version": "0.3.3",    
    "tough-cookie": "^0.12.1",
    "private-dep3": "git+ssh://[email protected]:reph/private-dep3.git#v0.3.5",
    "private-dep1": "git+ssh://[email protected]:reph/private-dep1.git#v0.7.5"
  }

The entire logs is as below:

PS C:\DDrive\Projects\p-ceck> npm cache clean
PS C:\DDrive\Projects\p-ceck>
PS C:\DDrive\Projects\p-ceck>
PS C:\DDrive\Projects\p-ceck> bower cache clean
PS C:\DDrive\Projects\p-ceck>
PS C:\DDrive\Projects\p-ceck>
PS C:\DDrive\Projects\p-ceck>
PS C:\DDrive\Projects\p-ceck> npm install
Enter passphrase for key '/c/Users/user_name/.ssh/id_rsa': Enter passphrase for key '/c/Users/user_name/.ssh/id_rsa': Enter passphrase for key|'/c/Users/user_name/.ssh/id_rsa': |
/nter passphrase for key '/c/Users/user_name/.ssh/id_rsa': /
-nter passphrase for key '/c/Users/user_name/.ssh/id_rsa': -
/nter passphrase for key '/c/Users/user_name/.ssh/id_rsa': \
|nter passphrase for key '/c/Users/user_name/.ssh/id_rsa': -
//ter passphrase for key '/c/Users/user_name/.ssh/id_rsa': /
-nter passphrase for key '/c/Users/user_name/.ssh/id_rsa': -
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep3.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep3-git-bf7ad496: Cloning into bare repository 'C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep3-git-bf7ad496'...
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep3.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep3-git-bf7ad496: Permission denied (publickey).
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep3.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep3-git-bf7ad496: fatal: Could not read from remote repository.
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep3.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep3-git-bf7ad496:
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep3.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep3-git-bf7ad496: Please make sure you have the correct access rights
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep3.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep3-git-bf7ad496: and the repository exists.
/
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep1.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep1-git-82b6a6b3: Cloning into bare repository 'C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep1-git-82b6a6b3'...
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep1.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep1-git-82b6a6b3: Permission denied (publickey).
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep1.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep1-git-82b6a6b3: fatal: Could not read from remote repository.
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep1.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep1-git-82b6a6b3:
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep1.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep1-git-82b6a6b3: Please make sure you have the correct access rights
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep1.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep1-git-82b6a6b3: and the repository exists.
/
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep2.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep2-git-426ffed6: Cloning into bare repository 'C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep2-git-426ffed6'...
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep2.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep2-git-426ffed6: Permission denied (publickey).
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep2.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep2-git-426ffed6: fatal: Could not read from remote repository.
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep2.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep2-git-426ffed6:
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep2.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep2-git-426ffed6: Please make sure you have the correct access rights
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep2.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep2-git-426ffed6: and the repository exists.

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! code 128

npm ERR! Command failed: git -c core.longpaths=true clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep3.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep3-git-bf7ad496
npm ERR! Cloning into bare repository 'C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep3-git-bf7ad496'...
npm ERR! 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!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     C:\DDrive\Projects\p-ceck\npm-debug.log
like image 340
wallop Avatar asked May 25 '15 07:05

wallop


People also ask

Does npm install install all dependencies?

By default, npm install will install all modules listed as dependencies in package.

How do I fix dependency issues in npm?

The easiest way to fix the issue is to pass an additional parameter –legacy-peer-deps to npm install. The --legacy-peer-deps tells the npm to ignore the peer dependencies and continue the installation of the package. Try the below command to install the dependencies for your project.

Why npm install is not working?

If your npm is broken: On Mac or Linux, reinstall npm. Windows: If you're on Windows and you have a broken installation, the easiest thing to do is to reinstall node from the official installer (see this note about installing the latest stable version).

How npm install specific dependencies?

For npm install specific version, use npm install [package-name]@[version-number]. Use npm view [package-name] version to know the specific latest version of a package available on the npm registry. Use npm list [package-name] to know the specific latest version of an installed package.


2 Answers

I had a similar problem. I ended up setting up ssh keys for my machine and npm was able to install with no problems.

How to set up ssh keys for github.com

like image 184
payne8 Avatar answered Nov 02 '22 09:11

payne8


For anyone that already has an SSH key set up with Github, the solution for me was to test my Github SSH account by entering ssh -T [email protected] into my terminal. That prompted me for my passphrase, which I entered and now NPM is working again. If you forgot your SSH passphrase, you may be able to recover it in the Keychain Access tool by searching for ssh.

like image 41
Ryan Hamley Avatar answered Nov 02 '22 10:11

Ryan Hamley