react-native-push-notification icon indicating copy to clipboard operation
react-native-push-notification copied to clipboard

react-native-push-notification Appears to be a git repo or submodule.

Open behnamshateri opened this issue 7 years ago • 23 comments

i have install react-native-push-notification and react-native link react-native-push-notification but when i want to install another package or run npm install i face with this error

node_modules\react-native-push-notification: Appears to be a git repo or submodule.

behnamshateri avatar Apr 26 '19 17:04 behnamshateri

Same here, I need to delete the package from my node_modules folder on the preinstall hook in order to make npm install work

WhippetsAintDogs avatar Apr 26 '19 20:04 WhippetsAintDogs

Deleting the .git folder on react-native-push-notification and npm install afterwards makes it work.

danielsotopino avatar Apr 28 '19 21:04 danielsotopino

Yes, but why does this happen in the first place?

tmaly1980 avatar Apr 30 '19 13:04 tmaly1980

This is something new with npm 6.9 i think

jeveloper avatar May 03 '19 19:05 jeveloper

remove any .git files present in the node_modules folder

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

shreyasb07 avatar May 03 '19 22:05 shreyasb07

Yeah. This was definitely bothering me as well. I agree that it seems like it shouldn't be happening in the first place?

infiniteline avatar May 17 '19 18:05 infiniteline

@zo0r This is a bug in this package. The ".git" directly should not be included in the npm package.

mcrowe avatar May 17 '19 20:05 mcrowe

@zo0r is this going to be fixed anytime soon? I'm getting tired of not being able to do npm install with ease

jdegger avatar May 21 '19 13:05 jdegger

I believe this is a problem with NPM (https://github.com/npm/npm/issues/20213)

danielsotopino avatar May 21 '19 17:05 danielsotopino

This only happens in latest version, 3.1.3. As a temporary workaround we use 3.1.2 for now, which seems to not have this problem.

mlazari avatar May 22 '19 09:05 mlazari

Would love to see a fix for this! @zo0r Please update the npm package 😆

davidcorbin avatar Jun 03 '19 11:06 davidcorbin

As a temporary fix we added the following to our scripts section of package.json:

    "preinstall": "rm -Rf ./node_modules/react-native-push-notification;"

This will probably not work on Windows but a similar solution on Windows can be applied.

jdegger avatar Jun 03 '19 13:06 jdegger

@mlazari I have the same problem with 3.1.2 version. rm -rf node_modules/*/.git worked for me.

SergeyIsakhanyan avatar Jun 04 '19 10:06 SergeyIsakhanyan

@SergeyIsakhanyan Did you remove node_modules folder before downgrading to 3.1.2?

mlazari avatar Jun 04 '19 10:06 mlazari

The issue is that .git was not ignored by putting it in your .npmignore. I've made a PR to fix this! @zo0r Please merge

#1085

isaiahols avatar Jun 12 '19 20:06 isaiahols

@isaiahols I'm looking at other dependencies we use that don't have this issue and they also don't have .git in their .npmignore files:

  • https://github.com/apollographql/react-apollo/blob/master/.npmignore
  • https://github.com/bamlab/react-native-formik/blob/master/.npmignore
  • https://github.com/react-native-community/react-native-svg/blob/master/.npmignore

react-native doesn't even seem to have a .npmignore file as far as I can tell.

That could solve the issue, but it's probably not the only issue. 3.1.3 was probably published with a problematic npm version that has the issue pointed above.

mlazari avatar Jun 13 '19 07:06 mlazari

@mlazari you are absolutely correct this is an not issue. The issue is that the npmignore is supposed to include the . git by default but it is not. So the current working solution while that is being sorted is to just include it manually. Then when the fix is up there is still no issue with including it in your npmignore as it is there by default.

Just something to help in the meantime as this only seems to effect a few dependencies, this one included.

isaiahols avatar Jun 13 '19 13:06 isaiahols

Is there a valid reason for having a .git folder in the node_modules dir?

tberghuis avatar Jun 16 '19 05:06 tberghuis

Is there a valid reason for having a .git folder in the node_modules dir?

No. You should never have anything under version control down there because changes you make will never be saved between installs.

drash-course avatar Jun 26 '19 14:06 drash-course

This PR will fix this issue. https://github.com/zo0r/react-native-push-notification/pull/1085

jack-douglas avatar Jul 05 '19 00:07 jack-douglas