npm error occurs because this package includes .git file
Hwan-seok opened this issue · comments
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
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
NPM should ignore .git
directory when publishing a package by default, so I am curious to know how this happened.
Is there a fix for this? Just trying to use this in ci and it's causing some issues. Thanks
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
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
....
@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.
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 followsBy default, the following paths and files are ignored, so there’s no need to add them to .npmignore explicitly:
.... .git ....
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.
Thanks @diogogvhenriques #94 seems to have fixed the issue for me. Thanks for the fast update 👍 🥇
glad to hear that
closing the issue