Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

broken devcontainer experience: npm ci fails #383

Closed
trenttobler opened this issue Nov 5, 2022 · 2 comments · Fixed by #384
Closed

broken devcontainer experience: npm ci fails #383

trenttobler opened this issue Nov 5, 2022 · 2 comments · Fixed by #384

Comments

@trenttobler
Copy link

Describe the bug

fschwaiger/cobertura-parse npm package link uses git/ssh. It looks like this causes issues in negotiating the ssh key when installing npm packages from within the container. I suspect there may be a way to configure this, but wondering if migrating to use https resolution instead works.

Steps To Reproduce

  1. git clone this repository
  2. launch vscode with microsoft remote extensions enabled
  3. open the source repository folder in devcontainer
  4. Notice error (same as below)
  5. type rm -rf node_modules
  6. try to install npm dependencies: npm i
  7. Error:
npm ERR! Error while executing:
npm ERR! /usr/local/bin/git ls-remote -h -t ssh://[email protected]/fschwaiger/cobertura-parse.git
npm ERR! 
npm ERR! [email protected]: 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! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2022-11-05T20_04_42_604Z-debug.log

Work Arounds

Option A (from devcontainer);

  1. run the command npm add cobertura-parse@https://github.com/fschwaiger/cobertura-parse#82b0333cb1580f6f337b5d44b04e2f5ca8711b7e
  2. run the command npm ci
  3. profit.

Option B (from container host):

  1. install node and npm
  2. setup ssh key with github
  3. run npm ci on a command line
  4. relaunch vscode devcontainer experience.
  5. profit.

Expected behaviour

I like that you've added the devcontainer experience. I have been advocating this same "development tooling as code" approach myself.

I think it would be expected that one can manage npm dependencies from within the container. This can be challenging for the non-npm public repository references - some orgs may have restrictions on git https vs. ssh that can limit be limiting,

Desktop (please complete the following information):

  • OS: windows 10 + WSL2 Ubuntu 20.04.4 LTS
  • Extension Version: N/A - github source repo
  • VSCode Version: 1.73.0

Additional context

Its unfortunate that the published cobertura-parse npm package is old and required a fork to fix. More ideal would be to be able to reference it directly instead of indirectly from github.

My original goal when I started exploring the code was to see if I could integrate the Koverage extension and, further, to enhance it with both line and branch coverage percentages.

@trenttobler trenttobler changed the title broken devcontainer experience broken devcontainer experience: npm ci fails Nov 5, 2022
@ryanluker ryanluker linked a pull request Nov 6, 2022 that will close this issue
@ryanluker
Copy link
Owner

ryanluker commented Nov 6, 2022

@trenttobler Thanks for submitting a ticket!
Good to see you found a workaround but it is definitely annoying and the dev containers should work out of the box (I use the codespaces one personally for small stuff all the time).

I made a branch here and tested in codespaces and locally via docker desktop.
It seemed to be working properly with the new node 16 and github specific flow for adding a npm package.
https://docs.npmjs.com/cli/v8/configuring-npm/package-json#github-urls
#384

Edit

Opps nope, it still resolves to using git + ssh if you look at the npm list afterwords.
It is odd that it still worked though locally for me 🤔.
[email protected] (git+ssh://[email protected]/fschwaiger/cobertura-parse.git#82b0333cb1580f6f337b5d44b04e2f5ca8711b7e)

ryanluker added a commit that referenced this issue Nov 20, 2022
* #383: Adjust dev container and cobertura

* #383: Try npm docs methods for github
@ryanluker
Copy link
Owner

@trenttobler this was merged into the master branch and should be good for you to use now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants