如何更新npm模块,忽略git回购 [英] How to update npm modules, ignoring a git repo
问题描述
dependencies:{
some-module:git + https://github.com/my-name/some-module.git,
}
通过提取上游和合并来同步分叉的repo。
但是当我尝试更新其他npm模块时,它会给出错误:
npm ERR! git看起来是一个git repo或submodule。
npm ERR! git /Users/.../node_modules/some-module
npm ERR! git拒绝删除它。手动更新,
npm ERR! git或者先把它移开。
npm ERR!系统Darwin 13.4.0
npm ERR!命令node/ usr / local / bin / npmupdate
npm ERR! cwd / Users / ...
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR!路径/Users/.../node_modules/some-module
npm ERR!代码EISGIT
npm ERR!
npm ERR!附加的日志记录细节可以在以下位置找到:
npm ERR! /Users/.../npm-debug.log
npm ERR!不正确的代码0
有什么办法可以在更新时忽略git repo吗?或者跳过这个错误?
npm检查所有目录是否存在 .git
目录,并抛出
EISGIT
错误(如果存在),所以无法忽略或跳过它。
code 然而检查它是否是链接:
mod.parent&& !mod.isLink&& [checkGit,mod.realpath],
所以我可以通过将模块符号链接到node_modules。
$ ln -s ../some-module node_modules
I forked one of npm modules and now it is a git repo.
So my package.json:
"dependencies": {
"some-module": "git+https://github.com/my-name/some-module.git",
}
Forked repo is synchronized by fetching upstream and merging. But when I try to update other npm modules it gives error:
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
Is there any way to ignore git repo when updating? Or to skip this error?
npm checks all directories for the existance of a .git
directory, and throws the EISGIT
error if it exists, so there is no way to ignore it or skip it.
The code does however check if it's a link:
mod.parent && !mod.isLink && [checkGit, mod.realpath],
So I was able to make it work by symlinking the module into node_modules.
$ ln -s ../some-module node_modules
这篇关于如何更新npm模块,忽略git回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!