Reputation: 970
I recently forked an npm package and updated it for my needs. Then, I changed the dependency on packages.json
to point to my GitHub repo, and it worked fine. But, when npm installed the module, it brought also the git folder (.git
). Because of that, when I try to install anything else, npm gives me this error:
npm ERR! path /node_modules/react-native-static-server
npm ERR! code EISGIT
npm ERR! git /node_modules/react-native-static-server: Appears to be a git repo or submodule.
npm ERR! git /node_modules/react-native-static-server
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.
What am I doing wrong? How do I avoid the .git
folder from being downloaded?
You can check the repo here: https://github.com/dccarmo/react-native-static-server
EDIT
The dependency in my packages.json
:
"react-native-static-server": "dccarmo/react-native-static-server"
Upvotes: 2
Views: 747
Reputation: 143
This seems to be an old question, but I was running into the same thing today. I am rather new to git and npm, but I did find something that may be of help to someone.
If the git repo does not have a .gitignore, the .git folder is not downloaded / created.
If the git repo does have a .gitignore, the .git folder is downloaded / created.
I had two repos, one without a .gitignore (because when I made it I was not aware of what .gitignore was or did), and one with a .gitignore. I included both as npm packages in a project, and noticed that the one without the .gitignore was not giving me the EISGIT error (because of the .git folder).
So, after I found this question, I removed the .gitignore from that repo and now it too does not create a .git folder.
Later on, I discovered that adding both a .gitignore and a .npmignore to the project now stops the .git folder from appearing. I did not add .git in my .npmignore.
Upvotes: 3