-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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] .gitignore file missing in tmp clone when installing a Git dependency #2144
Labels
Comments
isaacs
added a commit
to npm/pacote
that referenced
this issue
Jan 15, 2021
Occasionally, a package installed from a hosted git repo requires its .gitignore in order to properly run its install/prepare process. Since we should treat git dependencies as being just like installing from an install cut from the actual git repo itself, it's inappropriate to munge the .gitignore into .npmignore at this step (even though it _is_ appropriate to do so in most other cases with remote tarballs). This adds the `allowGitIgnore` flag, which is then in turn used by the GitFetcher when it makes its call to RemoteFetcher to download and extract the hosted tarball for preparation. This was not an issue in npm v6, because prior to npm v7, hosted git snapshot tarballs were not used, so it never would go through the code path of using a 'remote' type fetcher to download the contents of a git repository (which was also much slower). Fixes: npm/cli#2144
Took a bit of digging to see exactly what was going on here, but yes, this is a bug. Fixed by npm/pacote#59. |
isaacs
added a commit
to npm/pacote
that referenced
this issue
Jan 19, 2021
Occasionally, a package installed from a hosted git repo requires its .gitignore in order to properly run its install/prepare process. Since we should treat git dependencies as being just like installing from an install cut from the actual git repo itself, it's inappropriate to munge the .gitignore into .npmignore at this step (even though it _is_ appropriate to do so in most other cases with remote tarballs). This adds the `allowGitIgnore` flag, which is then in turn used by the GitFetcher when it makes its call to RemoteFetcher to download and extract the hosted tarball for preparation. This was not an issue in npm v6, because prior to npm v7, hosted git snapshot tarballs were not used, so it never would go through the code path of using a 'remote' type fetcher to download the contents of a git repository (which was also much slower). Fixes: npm/cli#2144
isaacs
added a commit
to npm/pacote
that referenced
this issue
Jan 19, 2021
Occasionally, a package installed from a hosted git repo requires its .gitignore in order to properly run its install/prepare process. Since we should treat git dependencies as being just like installing from an install cut from the actual git repo itself, it's inappropriate to munge the .gitignore into .npmignore at this step (even though it _is_ appropriate to do so in most other cases with remote tarballs). This adds the `allowGitIgnore` flag, which is then in turn used by the GitFetcher when it makes its call to RemoteFetcher to download and extract the hosted tarball for preparation. This was not an issue in npm v6, because prior to npm v7, hosted git snapshot tarballs were not used, so it never would go through the code path of using a 'remote' type fetcher to download the contents of a git repository (which was also much slower). Fixes: npm/cli#2144
This will be fixed when we pull pacote 11.2.2 into the cli. Thanks for reporting :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Current Behavior:
When npm v7 installs a Git dependency (e.g.
"github:jaydenseric/extract-files"
) it creates a clone of the repo in a tmp directory to pack the package for installation, running the packageprepare
script, etc. Normally (in npm v6) a.gitignore
file in the repo will be present in this clone, but it is missing for npm v7 installs. This cause cause problems if the packageprepare
script uses tools that utilize this file to ignore files or directories such asnode_modules
.This is a follow up issue to #2084 , as the original error preventing installation of a Git dependency has now been fixed in npm v7.0.9 but now we are now able to progress to yet another error.
Expected Behavior:
Steps To Reproduce:
Try
npm install
with thispackage.json
:Notice the error:
The reason for the error, is that the
jsdoc-md
command used in the packageprepare
script usually uses the project.gitignore
file to ignorenode_modules
when scanning for JSDoc when generating markdown docs under theAPI
heading inreadme.md
. For some reason, npm v7 clones most of the project files, but not.gitignore
- causing thejsdoc-md
command to error on some bad JSDoc innode_modules
.This is a serious breaking change, and is surely an npm v7 bug. Lots of tools that might be used in a package
prepare
script reference the project's.gitignore
file.Environment:
The text was updated successfully, but these errors were encountered: