Search code examples
gitnpm

How to update npm modules, ignoring a git repo


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?


Solution

  • 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