Search code examples
gitnpmyarnpkg

yarn fails during cloning repo: Permission denied (publickey)


I am trying to build this project locally on my desktop with Mac OS X 10.12:
https://github.com/lionsharecapital/lionshare-desktop

When I run yarn, I get:

yarn install v0.27.5
[1/4] Resolving packages...
[2/4] Fetching packages...
error Command failed.
Exit code: 128
Command: git
Arguments: clone ssh://git@github.com/prettier/prettier.git /Users/patrick/Library/Caches/Yarn/v1/.tmp/998d9289033d5404a23434d3979d79dc
Directory: /Users/patrick/dev/lionshare-desktop
Output:
Cloning into '/Users/patrick/Library/Caches/Yarn/v1/.tmp/998d9289033d5404a23434d3979d79dc'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Super confused, I manually ran git clone ssh://git@github.com/prettier/prettier.git /Users/patrick/Library/Caches/Yarn/v1/.tmp/998d9289033d5404a23434d3979d79d

And it worked fine... So, some how when yarn uses git, it's not making use of my global git config?

How can I fix this?

UPDATE

Trying this on a different computer strangely did not have this problem, however after installing, I did as their instructions stated:

yarn run dev

But I get:

yarn run v0.27.5
$ concurrently -k 'node desktop/server.dev.js' 'npm start'
[1] module.js:487
[1]     throw err;
[1]     ^
[1]
[1] Error: Cannot find module 'update-notifier'
[1]     at Function.Module._resolveFilename (module.js:485:15)
[1]     at Function.Module._load (module.js:437:25)
[1]     at Module.require (module.js:513:17)
[1]     at require (internal/module.js:11:18)
[1]     at /usr/local/lib/node_modules/npm/bin/npm-cli.js:29:19
[1]     at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:92:3)
[1]     at Module._compile (module.js:569:30)
[1]     at Object.Module._extensions..js (module.js:580:10)
[1]     at Module.load (module.js:503:32)
[1]     at tryModuleLoad (module.js:466:12)
[1] npm start exited with code 1
[0] listening on 3000
--> Sending SIGTERM to other processes..
[0] node desktop/server.dev.js exited with code null
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

2nd update

So apparently by running yarn, I broke npm completely, as I discovered if I attempt to do anything with npm, I get that same error:

>npm
module.js:487
    throw err;
    ^

Error: Cannot find module 'update-notifier'
    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 /usr/local/lib/node_modules/npm/bin/npm-cli.js:29:19
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:92:3)
    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)

This appears to be quite a disaster!

Update 3

uninstalling node and reinstalling did not fix this, I had to remove ~/.npm, and /usr/local/lib/node_modules, then uninstall node and reinstall and now npm is working again... Geez... Any idea on how I can build this project without it breaking my development environment like this?


Solution

  • yarnpkg PR 2384 (yarnpkg 0.19.0) should have fixed any issue with ssh URLs.
    Check if the URL should not be

    git+ssh://git@github.com:prettier/prettier.git
    

    Also, it seems to be a public repo, so you can try an https URL as well: you don't need authentication to clone said public repo.

    Regarding the second error message, you can follow issue kraken-js/issues/79.
    As a first workaround:

    npm install -g update-notifier,