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

Created on 26 Apr 2019  路  23Comments  路  Source: zo0r/react-native-push-notification

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.

Most helpful comment

remove any .git files present in the node_modules folder

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

All 23 comments

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

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

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

This is something new with npm 6.9 i think

remove any .git files present in the node_modules folder

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

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

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

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

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

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.

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

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.

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

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

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 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:

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 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.

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

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.

remove any .git files present in the node_modules folder

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

This helped me.Thanks

rm -rf node_modules/*/.git

Worked!

Any update on this? Still happening half a year later.

Was this page helpful?
0 / 5 - 0 ratings