aframevr / aframe

:a: Web framework for building virtual reality experiences.
https://aframe.io/
MIT License
16.61k stars 3.94k forks source link

Failing to install aframe from npm #5145

Open diarmidmackenzie opened 1 year ago

diarmidmackenzie commented 1 year ago

Description:

C:\Users\ASUS\Documents\GitHub\Test\test-physics-2>npm install aframe
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/ngokevin/debug.git
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! A complete log of this run can be found in:
npm ERR!     C:\Users\ASUS\AppData\Local\npm-cache\_logs\2022-11-04T16_09_03_570Z-debug-0.log

I found these issues, which seem similar:

4329

5057

Tried adding this to my .gitconfig as per #5057

[url "https://"]
    insteadOf = git://

But this hasn't helped. I get the same error.

I'll upload verbose output from the command (with that change to .gitconfig applied)

npm info using npm@8.17.0
npm info using node@v16.17.0

2022-11-04T16_26_54_020Z-debug-0.log

diarmidmackenzie commented 1 year ago

If I run the problematic command directly, it asks for the passphrase for my SSH key, and then seems to work successfully.

C:\Users\ASUS\Documents\GitHub\Test\test-physics-2>git --no-replace-objects ls-remote ssh://git@github.com/ngokevin/debug.git
Enter passphrase for key '/c/Users/ASUS/.ssh/id_ed25519':
9742c5f383a6f8046241920156236ade8ec30d53        HEAD
9742c5f383a6f8046241920156236ade8ec30d53        refs/heads/master
ef5f8e66d49ce8bc64c6f282c15f8b7164409e3a        refs/heads/noTimestamp
fc068941f030373f51aac24d3fd9ce4760aba300        refs/heads/v3
497a088b5f7a48a0c2ef10c8bd5aaf06e0f9d129        refs/tags/0.1.0
207be096d3fb98580ff074fc5fab13633905120c        refs/tags/0.2.0
b07efa967cccfe7cb52b14471c5e2994ac65e27b        refs/tags/0.3.0
a73176b16872ac4b7f904d23ed88b02a8ec17fa2        refs/tags/0.4.0
etc...
kylebakerio commented 1 year ago

npm install aframe works for me. I'm on npm 8.15.0, node v16.17.1, Pop OS (linux>debian>ubuntu>pop).

vincentfretin commented 1 year ago

It works on Ubuntu 22.04 node v16.18.0 npm 8.19.2 with my ssh rsa key without passphrase.

dmarcos commented 1 year ago

not sure what's special about that configuration. anything that should be done on A-Frame side?

kylebakerio commented 1 year ago

It sounds like an npm problem, but it is weird. I wonder if it was a temporary github server blip? Did you experience the failure multiple times, diarmid? Does it reproduce if you do it again in a clean directory?

dmarcos commented 1 year ago

Can i close this or there's something we need on A-Frame side?

diarmidmackenzie commented 1 year ago

This is not a transient thing - it is still broken for me, meaning I can't do aything with npm + a-frame at the moment.

Something that potentially would help would be migrating all the dependencies in package.json to reference NPM packages rather than GitHub URLs.

https://docs.npmjs.com/cli/v8/configuring-npm/package-json#github-urls

This, for instance "debug": "ngokevin/debug#noTimestamp",

This would require all the dependencies being published to npm:

    "debug": "ngokevin/debug#noTimestamp",
    "three-bmfont-text": "dmarcos/three-bmfont-text#21d017046216e318362c48abd1a48bddfb6e0733",        
    "markserv": "github:sukima/markserv#feature/fix-broken-websoketio-link",
    "too-wordy": "ngokevin/too-wordy",

Having a single mechanism for installing everything would definitely reduce surface area in terms of things that can go wrong.

diarmidmackenzie commented 1 year ago

OK - finally got round to trying Vincent's suggestion of using SSH keys without a passphrase, and I have now progressed to a new error:

C:\Users\ASUS\Documents\GitHub\Test\test-physics-2>npm install aframe
npm ERR! code 1
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects clone -b noTimestamp ssh://git@github.com/ngokevin/debug.git C:\Users\ASUS\AppData\Local\npm-cache\_cacache\tmp\git-cloneCXperv --recurse-submodules --depth=1 --config core.longpaths=true
npm ERR! Cloning into 'C:\Users\ASUS\AppData\Local\npm-cache\_cacache\tmp\git-cloneCXperv'...
npm ERR! git: 'submodule' is not a git command. See 'git --help'.
diarmidmackenzie commented 1 year ago

If I run this command by itself, it is successful...

git --no-replace-objects clone -b noTimestamp ssh://git@github.com/ngokevin/debug.git C:\Users\ASUS\AppData\Local\npm-cache\_cacache\tmp\git-cloneCXperv --recurse-submodules --depth=1 --config core.longpaths=true
vincentfretin commented 1 year ago

A different issue, but so that you are aware, it seems that the "github:" prefix may be an issue for some people, Someone reported he couldn't install networked-aframe because of this, he was using ubuntu and node 14 but I don't know how he installed node. I didn't have the issue myself on ubuntu 22.04 and node 16. Using the other github syntax fixed the issue for him, see https://github.com/networked-aframe/networked-aframe/pull/375 for details.

vincentfretin commented 1 year ago

Probably not the same git binary that is executed with npm? I know you had an issue also with husky and bash last time.

diarmidmackenzie commented 1 year ago

OK, I have "solved" this by:

Adding this to my .gitconfig

[url "https://"]
    insteadOf = git://
        insteadOf = ssh://

And adding this to my path (to deal with an error git: 'remote-https' is not a git command)

C:\Program Files\Git\mingw64\libexec\git-core

(as per this comment https://github.com/desktop/desktop/issues/10345#issuecomment-1005483477 )

diarmidmackenzie commented 1 year ago

It looks like the path update to include "C:\Program Files\Git\mingw64\libexec\git-core" was the critical bit.

Things are now working without this line in .gitconfig

 insteadOf = ssh://

I haven't gone back and tested all combination, but it looks like there's 2 different routes I could have taken to get this working:

1. Do everything over HTTPS

a) Add this to .gitconfig

[url "https://"]
    insteadOf = git://
        insteadOf = ssh://

b) Extend path to include "C:\Program Files\Git\mingw64\libexec\git-core"

2. Use SSH

a) No changes to .gitconfig

b) Create SSH keys locally, without a passphrase and add them to my GitHub account, as per instructions here

(if I'd been able to get ssh-agent working, maybe I could have used a passphrase)

c) Extend path to include "C:\Program Files\Git\mingw64\libexec\git-core"

diarmidmackenzie commented 1 year ago

In terms of what's needed for A-Frame, I'd say there's nothing essential, as it seems there are ways to muddle through issues that may arise.

But the overall installation would be less vulnerable to problems if it was standardized on a single method of package download, so it would be desirable to move to a position where all dependencies are npm packages, and downloaded from npm.

I think it's also desirable for dependencies like ngokevin/debug to be brought under the A-Frame umbrella, rather than being left to be maintained (or not) by someone no longer associated with A-Frame.