【发布时间】:2018-05-17 23:36:19
【问题描述】:
我最近派生了一个 npm 包并根据我的需要对其进行了更新。然后,我更改了对 packages.json 的依赖项以指向我的 GitHub 存储库,它运行良好。但是,当 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 文件夹被下载?
你可以在这里查看 repo:https://github.com/dccarmo/react-native-static-server
编辑
我的packages.json中的依赖:
"react-native-static-server": "dccarmo/react-native-static-server"
【问题讨论】:
-
"react-native-static-server": "https://github.com/dccarmo/react-native-static-server/tarball/master",最后带有 tarball 的东西不会为我下载 git 文件夹。我不知道为什么,所以我不会写它作为答案。只需将其指向 github 存储库即可下载 .git 目录。 -
@MikaS 有趣的发现!我可能会这样做作为临时修复。感谢您的帮助!
-
有同样的问题。由于某种原因,npm 没有将
.gitignore应用为/和.npmignore。 publish thou github.com/npm/npm/issues/19073 也有类似的问题(npm 包括我的 .git 目录) -
@Stamos 哦,好吧,很高兴知道这不仅仅是我!
-
@Stamos 请回答问题,以便我给你适当的学分。