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

npm error occurs because this package includes .git file #93

Closed
Hwan-seok opened this issue Feb 10, 2020 · 9 comments
Closed

npm error occurs because this package includes .git file #93

Hwan-seok opened this issue Feb 10, 2020 · 9 comments

Comments

@Hwan-seok
Copy link

Hwan-seok commented Feb 10, 2020

This package have .git file in node_modules installed via npm

MY_DIR/node_modules/serverless-plugin-optimize
$ ls -al
total 340
drwxr-xr-x 1 MY_NAME 197121    0  2월 10 19:25 ./
drwxr-xr-x 1 MY_NAME  197121    0  2월 10 19:17 ../
drwxr-xr-x 1 MY_NAME  197121    0  2월 10 19:25 .git/
-rw-r--r-- 1 MY_NAME  197121 1062 10월 26  1985 LICENSE
drwxr-xr-x 1 MY_NAME  197121    0  2월 10 18:10 node_modules/
-rw-r--r-- 1 MY_NAME  197121 2195  2월 10 18:10 package.json
-rw-r--r-- 1 MY_NAME  197121 5905 10월 26  1985 README.md
drwxr-xr-x 1 MY_NAME  197121    0  2월 10 18:09 src/

So it invokes following error
It must not be in distributed pacakge

Here is error log

C:\MY_DIR>npm install OTHER_PACAKGE
npm ERR! code EISGIT
npm ERR! path C:\MY_DIR\node_modules\serverless-plugin-optimize
npm ERR! git C:\MY_DIR\node_modules\serverless-plugin-optimize: Appears to be a git repo or submodule.
npm ERR! git C:\MY_DIR\serving\node_modules\serverless-plugin-optimize
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\USER_NAME\AppData\Roaming\npm-cache\_logs\2020-02-10T10_12_49_345Z-debug.log

env:
windows 10
npm : 6.12.0

@Hwan-seok
Copy link
Author

If anyone crashes with that error until the issue is resolved,
you need to remove the PROJECT_ROOT_DIR/node_modules/serverless-plugin-optimize/.git file

@katafractari
Copy link

katafractari commented Feb 18, 2020

NPM should ignore .git directory when publishing a package by default, so I am curious to know how this happened.

@Mantisimo
Copy link

Is there a fix for this? Just trying to use this in ci and it's causing some issues. Thanks

@Mantisimo
Copy link

Mantisimo commented Feb 20, 2020

Seems like it can be fixed by having an .npmignore file but as @katafractari says it should be ignored by default.

It's been fixed here in another lib by doing the above though.
APSL/react-native-version-number@9d6ea38

@Hwan-seok
Copy link
Author

Hwan-seok commented Feb 21, 2020

Hi @Mantisimo,

There is no updates ... The last modification of this repository is 2month ago..

Would It better If I create PR to this?


Edit +
npm document says as follows

By default, the following paths and files are ignored, so there’s no need to add them to .npmignore explicitly:

....
.git
....

https://docs.npmjs.com/using-npm/developers.html

@Mantisimo
Copy link

@Hwan-seok you could create a pr.. i've found something else interesting..
npm/npm-packlist#50
Seems if you have a symbolic link dependency the .git directory could be included.

@diogogvhenriques
Copy link
Collaborator

Hi @Mantisimo,

There is no updates ... The last modification of this repository is 2month ago..

Would It better If I create PR to this?

Edit +
npm document says as follows

By default, the following paths and files are ignored, so there’s no need to add them to .npmignore explicitly:

....
.git
....

https://docs.npmjs.com/using-npm/developers.html

Thanks for sharing this.
So right now with this looks an issue from npm. We can do a PR to at least force the ignore .git

From what @Mantisimo this might also be a scenario of a symbolic link which looks outside of this package.

@Mantisimo
Copy link

Thanks @diogogvhenriques #94 seems to have fixed the issue for me. Thanks for the fast update 👍 🥇

@diogogvhenriques
Copy link
Collaborator

glad to hear that

closing the issue

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

No branches or pull requests

4 participants