npm can't install `github:` dependencies
Description of Bug
Provide a concise description of your bug and your project link (if applicable).
npm supports Git URLs which likely depends on the git binary to exist. Because it doesn't on WebContainers, it seems to fail to install packages with github: dependencies.
Steps to Reproduce
Open a new StackBlitz project and run:
npm i @postlight/parser
Expected Behavior
A clear and concise description of what you expected to happen. For it to install normally.
Screenshots/Screencast
If applicable, add screenshots to help explain your problem.
❯ npm i @postlight/parser
npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno -2
npm ERR! enoent An unknown git error occurred
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /home/.npm/_logs/2023-07-26T07_14_29_662Z-debug-0.log
jsh: spawn npm ENOENT
Additional Context/Questions
https://github.com/privatenumber/pkg-size.dev/issues/14
Hi @privatenumber 👋 . Thanks for reaching out.
At the moment we don't expose the git binary via WebContainer API and StackBlitz Classic editor. If you use Codeflow to install that package, it works because Codeflow has the full potential in regards to git.
Exposing git via WebContainer API is something we discussed in the past but opted not to do because there's no way to pass in credentials and whatsoever.
Leaving this open as a feature request.
Hello @SamVerschueren -
Thanks for providing some background on this!
This is a very common workflow across all customer demographics I would image. A trivial (yet extremely common) scenario is:
- Someone identifies a bug in an open source library
- Creates repro using StackBlitz!
- Creates a PR (with tests of course 😄 )
- Uses the same repro in Step # 2 to link to the PR branch to demonstrate their incredible contribution to the project
Unfortunately, step 4 isn't possible unless using Codeflow but Codeflow doesn't support all the starter templates (correct me if I'm wrong). In a scenario like the above, getting that bug fixed in the project is the focus and StackBlitz's offering along with the starters make it super simple to create the repro in minutes and avoids having to create a repo all together. With codeflow, all the plumbing has to be re-created for the library/tool being targeted and often times the "samples" in the repro (if they even exist) are buried sub-directories deep which creates a lot of unnecessary noise in the repro.
According to this link and this, installing from github repos used to be possible (likely in the EngineBlock infra). There are other issues out there as well dating back to 2017.
Any chance that, even just for public projects as a starting point (which should simplify the creds issues, etc.), this will be added to Stackblitz?