`npm install` fails with "Permission denied" while cloning from GitHub

Hey, I tried to install the browser (with ⁠⁠⁠⁠npm install⁠⁠⁠⁠) and npm says “Permission denied (public key)” when it comes to cloning some repositories from GitHub. When I look them up by hand, they’re all without any special permissions.

Does somebody know why that’s failing? Or do I need some permissions to clone these repositories and missed it?

npm log
me@zeus:~/blockstack/blockstack-browser$ npm --verbose install

[...]

npm http request GET https://registry.npmjs.org/base-x
npm http 304 https://registry.npmjs.org/base-x
npm verb headers { date: 'Wed, 14 Dec 2016 16:52:00 GMT',
npm verb headers   via: '1.1 varnish',
npm verb headers   'cache-control': 'max-age=300',
npm verb headers   etag: 'W/"583aeaed-2ace"',
npm verb headers   age: '192',
npm verb headers   connection: 'keep-alive',
npm verb headers   'x-served-by': 'cache-fra1238-FRA',
npm verb headers   'x-cache': 'HIT',
npm verb headers   'x-cache-hits': '1',
npm verb headers   'x-timer': 'S1481734320.226066,VS0,VE0',
npm verb headers   vary: 'Accept-Encoding' }
npm verb etag https://registry.npmjs.org/base-x from cache
npm verb get saving base-x to /home/me/.npm/registry.npmjs.org/base-x/.cache.json
npm verb correctMkdir /home/me/.npm correctMkdir not in flight; initializing
npm verb cache add spec base-x@^1.1.0
npm verb addNamed ">=1.1.0 <2.0.0" is a valid semver range for base-x
npm verb addNameRange registry:https://registry.npmjs.org/base-x not in flight; fetching
npm verb get https://registry.npmjs.org/base-x not expired, no request
npm verb addNamed "1.1.0" is a plain semver version for base-x
npm verb afterAdd /home/me/.npm/base-x/1.1.0/package/package.json not in flight; writing
npm verb correctMkdir /home/me/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/me/.npm/base-x/1.1.0/package/package.json written
npm verb cache add spec bitcoinjs-lib@git+ssh://[email protected]/shea256/bitcoinjs-lib.git
npm verb cache add spec ecurve@git+ssh://[email protected]/shea256/ecurve.git
npm verb addRemoteGit caching git+ssh://[email protected]/shea256/bitcoinjs-lib.git
npm verb addRemoteGit git+ssh://[email protected]/shea256/bitcoinjs-lib.git is a repository hosted by github
npm verb tryClone git-ssh-git-github-com-shea256-bitcoinjs-lib-git-33ec648a not in flight; caching
npm verb correctMkdir /home/me/.npm/_git-remotes correctMkdir not in flight; initializing
npm verb addRemoteGit caching git+ssh://[email protected]/shea256/ecurve.git
npm verb addRemoteGit git+ssh://[email protected]/shea256/ecurve.git is a repository hosted by github
npm verb tryClone git-ssh-git-github-com-shea256-ecurve-git-cd23c494 not in flight; caching
npm verb correctMkdir /home/me/.npm/_git-remotes correctMkdir not in flight; initializing
npm verb request uri https://registry.npmjs.org/core-js
npm verb request no auth needed
npm info attempt registry request try #1 at 17:52:00
npm verb etag W/"5847949d-387ed"
npm verb lastModified Wed, 07 Dec 2016 04:48:29 GMT
npm http request GET https://registry.npmjs.org/core-js
npm info git [ 'config', '--get', 'remote.origin.url' ]
npm info git [ 'config', '--get', 'remote.origin.url' ]
npm verb validateExistingRemote git+ssh://[email protected]/shea256/bitcoinjs-lib.git is updating existing cached remote /home/me/.npm/_git-remotes/git-ssh-git-github-com-shea256-bitcoinjs-lib-git-33ec648a
npm verb validateExistingRemote git+ssh://[email protected]/shea256/ecurve.git is updating existing cached remote /home/me/.npm/_git-remotes/git-ssh-git-github-com-shea256-ecurve-git-cd23c494
npm info git [ 'fetch', '-a', 'origin' ]
npm info git [ 'fetch', '-a', 'origin' ]
npm http 304 https://registry.npmjs.org/core-js
npm verb headers { date: 'Wed, 14 Dec 2016 16:52:00 GMT',
npm verb headers   via: '1.1 varnish',
npm verb headers   'cache-control': 'max-age=300',
npm verb headers   etag: 'W/"5847949d-387ed"',
npm verb headers   age: '248',
npm verb headers   connection: 'keep-alive',
npm verb headers   'x-served-by': 'cache-fra1238-FRA',
npm verb headers   'x-cache': 'HIT',
npm verb headers   'x-cache-hits': '7',
npm verb headers   'x-timer': 'S1481734320.295714,VS0,VE0',
npm verb headers   vary: 'Accept-Encoding' }
npm verb etag https://registry.npmjs.org/core-js from cache
npm verb get saving core-js to /home/me/.npm/registry.npmjs.org/core-js/.cache.json
npm verb correctMkdir /home/me/.npm correctMkdir not in flight; initializing
npm verb cache add spec core-js@^2.0.3
npm verb addNamed ">=2.0.3 <3.0.0" is a valid semver range for core-js
npm verb addNameRange registry:https://registry.npmjs.org/core-js not in flight; fetching
npm verb get https://registry.npmjs.org/core-js not expired, no request
npm verb addNamed "2.4.1" is a plain semver version for core-js
npm verb afterAdd /home/me/.npm/core-js/2.4.1/package/package.json not in flight; writing
npm verb correctMkdir /home/me/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/me/.npm/core-js/2.4.1/package/package.json written
npm ERR! git fetch -a origin (ssh://[email protected]/shea256/ecurve.git) Permission denied (publickey).
npm ERR! git fetch -a origin (ssh://[email protected]/shea256/ecurve.git) fatal: Could not read from remote repository.
npm ERR! git fetch -a origin (ssh://[email protected]/shea256/ecurve.git) 
npm ERR! git fetch -a origin (ssh://[email protected]/shea256/ecurve.git) Please make sure you have the correct access rights
npm ERR! git fetch -a origin (ssh://[email protected]/shea256/ecurve.git) and the repository exists.
npm ERR! git fetch -a origin (ssh://[email protected]/shea256/bitcoinjs-lib.git) Permission denied (publickey).
npm ERR! git fetch -a origin (ssh://[email protected]/shea256/bitcoinjs-lib.git) fatal: Could not read from remote repository.
npm ERR! git fetch -a origin (ssh://[email protected]/shea256/bitcoinjs-lib.git) 
npm ERR! git fetch -a origin (ssh://[email protected]/shea256/bitcoinjs-lib.git) Please make sure you have the correct access rights
npm ERR! git fetch -a origin (ssh://[email protected]/shea256/bitcoinjs-lib.git) and the repository exists.
npm verb stack Error: Command failed: git fetch -a origin
npm verb stack Permission denied (publickey).
npm verb stack fatal: Could not read from remote repository.
npm verb stack 
npm verb stack Please make sure you have the correct access rights
npm verb stack and the repository exists.
npm verb stack 
npm verb stack     at ChildProcess.exithandler (child_process.js:211:12)
npm verb stack     at emitTwo (events.js:106:13)
npm verb stack     at ChildProcess.emit (events.js:191:7)
npm verb stack     at maybeClose (internal/child_process.js:885:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
npm verb cwd /home/me/blockstack/blockstack-browser
npm ERR! Linux 4.8.12-2-ARCH
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "--verbose" "install"
npm ERR! node v7.2.1
npm ERR! npm  v4.0.3
npm ERR! code 128

npm ERR! Command failed: git fetch -a origin
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 verb exit [ 1, true ]

npm ERR! Please include the following file with any support request:
npm ERR!     /home/me/blockstack/blockstack-browser/npm-debug.log

What branch are you running npm install on? The most recent code is on the web branch. master branch very well may not work.

Also, do you have your ssh public key added to your github account? It appears from the log the package trying to be installed is being accessed over ssh - we shouldn’t be listing packages in package.json with ssh but instead https. I’ll check to make sure this isn’t the case in the web branch.

@vsund I’ve confirmed this problem exists in web branch as well. Have created an issue and will fix it soon! Thanks for reporting and apologies for the inconvenience! https://github.com/blockstack/blockstack-browser/issues/125

What branch are you running npm install on?

I tried the master, good to know that I better use the web branch :slight_smile:

Also, do you have your ssh public key added to your github account?

Yeah, I could type in my password into the first prompt and it went a bit further, but then it failed later (I guess npm doesn’t handle the password prompts corrently).

I tried to replace “git+ssh://[email protected]” with “git+https://github.com” to see if it fixes the issue (partially worked), but then there were additional repositories which got cloned and their installation called “git+ssh://” too.
So you might want to go through the other repositories too :wink:

@vsund Should be fixed! https://github.com/blockstack/blockstack-browser/commit/91d0d33dab8a35ebd97ae3d16f83ac115adf09dd

Let us know if you still have the same problem!