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+",

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?

  • “git checkout tag-name” vs “git reset --hard tag-name”
  • Git checkout branch leaves directory tree from other branch
  • add #*# glob to .gitignore?
  • Can I 'git commit' a file and ignore its content changes?
  • What goes wrong when using git worktree with git submodules
  • What is the 'standard' content of .gitignore for an iPhone (Xcode) project?
  • 2 responses to “How to update npm modules, ignoring a git repo”

      Venryx said:

      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
      bolav said:

      Yes, there’s a way to skip the error.

      1) Open the file “C:\Program Files\nodejs\node_modules\npm\node_modules\npm-install-checks\index.js”
      2) Comment out this code at the very bottom:

      if (!er && s.isDirectory()) {
        var e = new Error(folder + ': Appears to be a git repo or submodule.')
        e.path = folder
        e.code = 'EISGIT'
        return cb(e)



      From another dev long frustrated by this error; none of the suggested solutions work in my case because of constraints from various systems.

      Suggestion: NPM works with symlinks, so create symlink of module from node_modules, to your library repo folder.
      Problem: Then Watchman doesn’t scan the JS files within.

      Suggestion: Do “npm publish” and “npm install”. Every. Single. Time.
      Problem: Terrible for quick development tests/cycles, and spams the npm directory with hundreds of never-to-be-used versions.

      Suggestion: Use Watchman Links (WML). (i.e. directory auto-copying on file-change)
      Problem: Have to have a background program running all the time, for all the included repos on my machine. Also, it means I can’t open the files directly in the node_modules folder to make quick changes; instead I have to go to the library’s source repo every time. That’s fine usually, but sometimes it’s nice to make changes in the program repo, and have it reflected in the library repo, in addition to vice-versa.

      My solution

      So yeah, with the above change, I can use a hard-link clone of the library directory and avoid the problems above.

      I use this to create the directory-level hard-link clone:

      The one problem with this approach is that I have to re-run the hard-link clone whenever I add or remove files in the library. But at least I don’t have to do anything when changes are made within existing files. (which is by far more painful)

    Git Baby is a git and github fan, let's start git clone.