-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[BUG] Failed to install npm package from git in docker since v6.11.0 #624
Comments
I have the same issue with npm 6.13.4. |
@isaacs please, take a look on this |
Is the npm command being run as root, or some other user? I'd like to try to zoom in on the problem and leave the docker aspect out of it. If I understand this correctly:
Simpler reproduction, sans docker:
I will take a look today and see how hard this'll be to fix. |
Note for myself and @npm/cli-team: this problem does not occur with pacote v10, so it's strictly a pacote v9 issue. To verify this, I applied this diff to pacote: diff --git a/lib/git.js b/lib/git.js
index ade670b..a79a0e1 100644
--- a/lib/git.js
+++ b/lib/git.js
@@ -36,6 +36,7 @@ class GitFetcher extends Fetcher {
constructor (spec, opts) {
super(spec, opts)
this.resolvedRef = null
+ this.spec.hosted = null
if (this.spec.hosted)
this.from = this.spec.hosted.shortcut({ noCommittish: false })
(This is required because otherwise pacote v10 will try to fetch github repos from their static tarball endpoint, as that's usually much faster.) Then ran:
|
Fix: npm/cli#624 Infer the ownership of a git command invocation based on the cwd, if one is specified.
Fix: npm/cli#624 Infer the ownership of a git command invocation based on the cwd, if one is specified.
Looks like npm/pacote#26 will fix this problem, assuming that I am understanding the root cause. (At the very least, it fixes a problem, which is that running |
Fix: npm/cli#624 Fix: npm/cli#642 Fix: npm/cli#514 Infer the ownership of a git command invocation based on the cwd, if one is specified.
Yes, npm install is being run as root. Thanks for the fix! |
@isaacs Installing npm packages from git private repositories in docker still fails (since v6.11.0 and still fails with 6.13.6) when using a ~/.netrc file or ~/.git-credentials file
|
@simonkotwicz That's a different issue. Can you please post a new issue describing the situation, ideally with a more fleshed-out reproduction case? |
opened #950 |
Using npm in a docker, the issue still occurs to me. With:
Any idea? |
same here ;/ |
@augnustin after downgrade to version 6.10 all is working fine... |
I'm facing same problem at npm@v7.7.0 on docker |
I also face this issue with node 7 (every subversion)
|
I ran into this issue on several subversions, including 7.13.0, on WSL Debian. Interestingly, the project was installed in |
Hi, same issue with Npm 7. It works fine with 6.14.* |
A fresh issue describing the failure on npm 7 would be helpful. |
broken for me on 7 |
I tried something : use |
Broken for me too on: |
Broken for me as well (with a package having github dependencies). Any info on a fix? |
None of these install methods work:
They all throw:
I have |
same here |
I run into this error, Then I tried yarn, it worked. |
Hi, I've also come across the same error, If you look deeper into the logs you can see that the issue lies on the
|
Good idea, but with
Also, because I was running under |
If run manually run |
Explicitly pecify git+https://git@github.com/{user}/{repo}.git to workaround npm "feature" of rewriting GitHub package specs (npm/cli#2610), which applies on GitHub Actions after the Ubuntu 20.04 image 20211129.1 update (actions/runner-images#4625) upgraded to Node v16.13.0 (npm v8.1.0) Finally, stop using sudo in order to avoid permissions issue on the npm cache (npm/cli#624)
Explicitly pecify git+https://git@github.com/{user}/{repo}.git to workaround npm "feature" of rewriting GitHub package specs (npm/cli#2610), which applies on GitHub Actions after the Ubuntu 20.04 image 20211129.1 update (actions/runner-images#4625) upgraded to Node v16.13.0 (npm v8.1.0) Finally, stop using sudo in order to avoid permissions issue on the npm cache (npm/cli#624)
I'm facing this issue when trying to install from a Gitlab private repo using HTTPS with |
When I previously post log for issue I investigated the problem. This happens bacuase npm tries to clone ( In my case the owner of directory was To prevent this issue (untill it would be fixed) you must run
Or change owner for current directory:
|
@likemusic For my case the directory that contains |
This worked for me: |
Before this commit it was required to install the package using Github. However when using NPM version 8.5, the installation used to fail with the following error : "... git --no-replace-objects clone https://git@github.com/ElucidataInc/node-s3-client.git /root/.npm/_cacache/tmp/git-cloneNZtpAU --recurse-submodules npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-cloneNZtpAU': Permission denied" The following Github threads were reported with similar issues - npm/cli#624 - npm/cli#642 As the suggested methods in the above threads, like shifting to older version of NPM, did not satisfy our needs, we are publishing the package to NPM public registry
When there is a reference to a git library in package json, like : |
What / Why
This bug is related to #476 (comment) and #514
When
npm install
packages from git in dockerWhere
How
Current Behavior
Steps to Reproduce
docker run --network=host -it -v $(pwd):/var/work/test -w /var/work/test node:12.14.0 /bin/bash
ls -l
shows that files are owned by unknown user and unknown group (this is typical behaviour on build agents like teamcity, teamcity clones git repo and mounts it inside docker container)npm install
npm i -g npm@6.10
(downgrade to npm 6.10.X)npm install
Expected Behavior
npm install
/npm ci
works well like npm@6.10The text was updated successfully, but these errors were encountered: