Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 从GitHub中获取npm模块会带来";。吉特;文件夹_Node.js_Git_Github_Npm - Fatal编程技术网

Node.js 从GitHub中获取npm模块会带来";。吉特;文件夹

Node.js 从GitHub中获取npm模块会带来";。吉特;文件夹,node.js,git,github,npm,Node.js,Git,Github,Npm,我最近推出了一个npm包,并根据我的需要进行了更新。然后,我更改了对packages.json的依赖关系,以指向我的GitHub repo,它运行良好。但是,当npm安装模块时,它还带来了git文件夹(.git)。因此,当我尝试安装其他任何东西时,npm会给我以下错误: npm ERR! path /node_modules/react-native-static-server npm ERR! code EISGIT npm ERR! git /node_modules/react-nativ

我最近推出了一个npm包,并根据我的需要进行了更新。然后,我更改了对
packages.json
的依赖关系,以指向我的GitHub repo,它运行良好。但是,当npm安装模块时,它还带来了git文件夹(
.git
)。因此,当我尝试安装其他任何东西时,npm会给我以下错误:

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.
我做错了什么?如何避免下载
.git
文件夹

您可以在此处查看回购协议:

编辑

my
packages.json中的依赖项:


“react native static server”:“dccarmo/react native static server”

这似乎是个老问题,但我今天遇到了同样的问题。 我对git和npm比较陌生,但我确实发现了一些可能对某人有帮助的东西

如果git repo没有包含.gitignore,则不会下载/创建.git文件夹

如果git repo确实有一个.gitignore,则下载/创建.git文件夹

我有两份回购协议,一份没有.gitignore(因为当我进行回购时,我不知道.gitignore是什么或做了什么),另一份有.gitignore。我将两者都作为npm包包含在一个项目中,并注意到没有.gitignore的一个没有给我EISGIT错误(因为.git文件夹)

因此,在我发现这个问题后,我从repo中删除了.gitignore,现在它也没有创建.git文件夹


后来,我发现将.gitignore和.npmignore添加到项目中会阻止.git文件夹出现。我没有在.npmignore中添加.git。

“react native static server”:https://github.com/dccarmo/react-native-static-server/tarball/master“
,结尾是tarball的东西,我无法下载git文件夹。我不知道为什么,所以我不会写它作为一个答案。只是把它指向github repo下载的.git目录。@MikaS有趣的发现!我可能会把这当作一个临时的解决办法。谢谢你的帮助!我也有同样的问题。由于某些原因,npm没有将
.gitignore
作为/和
.npmignore
应用。publish thou也有类似的问题(npm包括我的.git目录)@Stamos哦,好吧,很高兴知道不仅仅是我@斯塔莫斯请回答这个问题,这样我可以给你适当的学分。谢谢你的回答!这似乎是npm的一个已知问题,显然还没有解决。我喜欢你的解决方案,所以我会接受它,因为它有点包括我必须要做的解决方案。