我分叉了一个 npm 模块,现在它是一个 git 存储库。
所以我的 package.json:
"dependencies": {
"some-module": "git+https://github.com/my-name/some-module.git",
}
分叉的存储库通过获取上游并合并来同步。
但是当我尝试更新其他 npm 模块时,出现错误:
npm ERR! git Appears to be a git repo or submodule.
npm ERR! git /Users/.../node_modules/some-module
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.
npm ERR! System Darwin 13.4.0
npm ERR! command "node" "/usr/local/bin/npm" "update"
npm ERR! cwd /Users/...
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! path /Users/.../node_modules/some-module
npm ERR! code EISGIT
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/.../npm-debug.log
npm ERR! not ok code 0
有没有办法在更新时忽略 git repo?或者跳过这个错误?
npm 检查所有目录是否存在.git
目录,并抛出EISGIT
如果存在错误,因此无法忽略或跳过它。
The code https://github.com/npm/npm/blob/f2ae3baf9e4b48282bcfceb94ce861b9221450d0/lib/install/validate-tree.js#L24但是会检查它是否是一个链接:
mod.parent && !mod.isLink && [checkGit, mod.realpath],
因此,我可以通过将模块符号链接到 node_modules 来使其工作。
$ ln -s ../some-module node_modules
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)