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

Repeatedly performing npm-install fails with EISGIT: Appears to be a git repo or submodule #13

Closed
sdduursma opened this issue Oct 20, 2017 · 43 comments

Comments

@sdduursma
Copy link

When repeatedly performing npm install with a dependency on react-native-version-number, npm fails with the error code EISGIT.

I have declared a dependency on on react-native-version-number in my package.json like so:

  ...
  "dependencies": {
    "react-native-version-number": ">=0.2.0",
    ...
  },
  ...

Performing npm install for the first time succeeds. Performing npm install immediately again will fail:

$ rm -rf node_modules/
$ npm install
$ <installation succeeds>
$
$ npm install
npm ERR! path <path/to/project/root>/node_modules/react-native-version-number
npm ERR! code EISGIT
npm ERR! git <path/to/project/root>/node_modules/react-native-version-number: Appears to be a git repo or submodule.
npm ERR! git     <path/to/project/root>/node_modules/react-native-version-number
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.

When inspecting the installed react-native-version-number module in node_modules, I found that the module contains a .git file.

Any help resolving this failure would be much appreciated. Thanks!

@alexgvozden
Copy link

seems that project owner needs to remove git repository from the package...

@kkjdaniel
Copy link

kkjdaniel commented Nov 1, 2017

+1 I am also having this issue. As @alexgvozden mentions, the package needs to be updated to remove the .git directory from the package. As a temporary fix for @sdduursma , just go into the directory and use rm -rf .git this will stop NPM complaining.

@karltaylor
Copy link

Any plans on this getting fixed?

@joncursi
Copy link

Bump 😅

@neo125874
Copy link

@kkjdaniel 's solution got this work!

@unpokolokko
Copy link

unpokolokko commented Jan 8, 2018

i solved this problem by removing it before performing npm install again as it suggests.

@viacheslav-gotsuliak
Copy link

Having same issue

@mieszko4
Copy link

Please fix it, I have the same issue

@tnyavdc
Copy link

tnyavdc commented Jan 26, 2018

Bump

@evanjmg
Copy link

evanjmg commented Jan 30, 2018

+1

@geekyDP
Copy link

geekyDP commented Jan 31, 2018

Having same issue

@trietlam
Copy link

trietlam commented Feb 4, 2018

same issue, and have to manually remove .git directory inside the package

@pellarboss
Copy link

+1

5 similar comments
@yutakaA
Copy link

yutakaA commented Feb 14, 2018

+1

@IrfyNaz
Copy link

IrfyNaz commented Feb 20, 2018

+1

@goldengecko
Copy link

+1

@VinceBT
Copy link

VinceBT commented Mar 3, 2018

+1

@craig8two
Copy link

+1

@keech
Copy link

keech commented Mar 13, 2018

+1

@adrianboimvaser
Copy link

Is this project dead?

@duongntb94
Copy link

  • 1

@Lastin
Copy link
Contributor

Lastin commented Mar 16, 2018

Related issue. #20
Fixed in: #24

@alvaromb
Copy link
Collaborator

Sorry! Not dead, just very very busy.

This was merged & solved a while ago.

Thanks for reporting!

@VinceBT
Copy link

VinceBT commented May 28, 2018

By the way could you also add these files to ignore in the .npmignore ?

They are useless for the user and it just makes your package heavier.

.idea
.eslintrc
.travis.yml

@alvaromb
Copy link
Collaborator

Will try to do it later, @VinceBT. Cool avatar BTW 😉

FabianLauer added a commit to FabianLauer/FSPromise that referenced this issue Sep 11, 2018
Thi should fix `EISGIT` errors during `npm install`. The error happened with npm v6.2.0 (probably other versions as well) when `npm i` was run multiple times in a repo (e.g. for package updates). It did not matter whether the FSPromise package was installed as a direct dependency of the repo or as a 2nd level dependency.

A very similar problem was documented here:
APSL/react-native-version-number#13
@hadicodes
Copy link

+1 I am also having this issue. As @alexgvozden mentions, the package needs to be updated to remove the .git directory from the package. As a temporary fix for @sdduursma , just go into the directory and use rm -rf .git this will stop NPM complaining.

This^ worked for me since I had a custom module (not from) npm installed and it had a .git hidden folder tracking it. Thanks @kkjdaniel !

@jose2007kj
Copy link

jose2007kj commented Jan 3, 2019

rm -rf .git

i did his coomand from my project root folder and i lost my .git file and the branches,make sure you dont use this command in wrong place

@jo3ran
Copy link

jo3ran commented May 3, 2019

Hey,

I don't want to delete the .git folder in one of the npm packages, since I'm checking out the latest updates for this package from the repo. Thus, I'm not able to install other npm packages, since it keeps complaining, that this particular package has a git repo.

How to proceed? Or: What's the reason of this behavior?

@jose2007kj
Copy link

jose2007kj commented May 3, 2019

@jo3ran refer this stackoverflow question How to update npm modules, ignoring a git repo some imes it might be helpfull

@tajpouria
Copy link

tajpouria commented May 10, 2019

Ubuntu 18.4
i had same issue fixing by going to given directory and remove .git " rm -rf .git " in my case : /home/lenovo/Desktop/native/fun/jobs/node_modules/react-native-safe-area-view

@zandi2015
Copy link

+1 I am also having this issue. As @alexgvozden mentions, the package needs to be updated to remove the .git directory from the package. As a temporary fix for @sdduursma , just go into the directory and use rm -rf .git this will stop NPM complaining.

you can use rm -rf node_modules/package_name/.git/ in root terminal....

@Seb6277
Copy link

Seb6277 commented May 15, 2019

Same problem while installing moment package.
npm install --save moment

it say react-native-safe-area-view is a git repo.

I've remove the .git folder and it's works. Are they a reason to put the .git into the package ?

@arcollector
Copy link

add this to your package.json file in the scripts json part

"scripts": {
    ...,
    "preinstall": "rm -rf node_modules/react-native-safe-area-view/.git"
  },

@ABibin
Copy link

ABibin commented May 30, 2019

remove any .git files present in the node_modules folder

In your terminal, from your project folder:
rm -rf node_modules/*/.git

@davidseek
Copy link

add this to your package.json file in the scripts json part

"scripts": {
    ...,
    "preinstall": "rm -rf node_modules/react-native-safe-area-view/.git"
  },

this works perfectly. thank you

@nishurishabh
Copy link

kkjdaniel worked for me.

@cjbt
Copy link

cjbt commented Jul 22, 2019

+1 I am also having this issue. As @alexgvozden mentions, the package needs to be updated to remove the .git directory from the package. As a temporary fix for @sdduursma , just go into the directory and use rm -rf .git this will stop NPM complaining.

I don't care if this was 2+ years ago. This was the fix for me and I want to say that I love you.

@BwL1289
Copy link

BwL1289 commented Aug 28, 2019

+1 I am also having this issue. As @alexgvozden mentions, the package needs to be updated to remove the .git directory from the package. As a temporary fix for @sdduursma , just go into the directory and use rm -rf .git this will stop NPM complaining.

I don't care if this was 2+ years ago. This was the fix for me and I want to say that I love you.

i also love @alexgvozden

@dirkdirk
Copy link

dirkdirk commented Nov 6, 2019

Try updating NPM to version 6.10. This is a known issue with NPM v6.9.

https://npm.community/t/npm-6-9-1-is-broken-due-to-git-folder-in-published-tarball/8454/5

@cherucole
Copy link

+1 I am also having this issue. As @alexgvozden mentions, the package needs to be updated to remove the .git directory from the package. As a temporary fix for @sdduursma , just go into the directory and use rm -rf .git this will stop NPM complaining.

This worked like a charm for me

@prideaux
Copy link

prideaux commented Dec 6, 2019

add this to your package.json file in the scripts json part

"scripts": {
    ...,
    "preinstall": "rm -rf node_modules/react-native-safe-area-view/.git"
  },

I also use:

"postinstall": "rm -rf node_modules/react-native-safe-area-view/.git"

so that if npm install is run then it removes it after installing also.

Therefore I have:

  "scripts": {
    ...,
    "preinstall": "rm -rf node_modules/react-native-safe-area-view/.git",
    "postinstall": "rm -rf node_modules/react-native-safe-area-view/.git"
  },

@cjo2
Copy link

cjo2 commented Dec 10, 2019

Hi there, not sure if this is specific to the zsh console, but I had to adjust the command for it to work for me (two asterisks instead of one).

rm -rf node_modules/**/.git/

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