0

In my Node.js project, I have a dependency gulp which has a dependency vinyl-fs which has a dependency glob-watcher which has a dependency gaze. glob-watcher is version 0.0.6 has its gaze dependency set to ^0.5.1.

According to this post the ^ (caret) means that the latest minor version is accepted. So I expect glob-watcher to install the latest minor version of gaze, which (at the time of this writing) is 0.6.4. But it doesn't, only 0.5.1 is installed.

Question: Why? How do I fix this?

I have tried adding the following npm-shrinkwrap.json to my project root and running rm -rf node_modules/ && npm install:

{
  "name": "MyProject",
  "version": "0.0.1",
  "dependencies": {
    "gulp": {
      "version": "3.8.11",
      "from": "gulp@~3.8.10",
      "dependencies": {
        "vinyl-fs": {
          "version": "0.3.13",
          "from": "vinyl-fs@^0.3.0",
          "dependencies": {
            "glob-watcher": {
              "version": "0.0.6",
              "from": "glob-watcher@^0.0.6",
              "dependencies": {
                "gaze": {
                  "version": "0.6.4",
                  "from": "gaze@^0.5.1"
                }
              }
            }
          }
        }
      }
    }
  }
}

That did make it so the version of gaze that I wanted was installed, but unfortunately that configuration results in ONLY those 4 dependencies being installed. I could specify my entire dependency tree to fix that, but that would be undesirable, especially because I'd just like to override that one package. (But it doesn't seem like overriding should even be necessary, according to the purported behavior of ^.)

Obviously I could also write a shell script to cd to that dependency and manually npm install the version I want, but I'd rather do this the "right" way, if there is one.

Any help would be greatly appreciated.

Community
  • 1
  • 1
Jackson
  • 9,188
  • 6
  • 52
  • 77

1 Answers1

0

Why?

Pretty simple: the latest version of gaze has just not been npm published yet, and is still on version 0.5.1 on the npm repo

How do I fix this?

You kinda scr***. The solution would be to use a npm install [githubtarball] --save but you don't want to manually edit the package.json of a dependency, and you ton want to fork glob-watcher, vinyl-fs and gulp.

Edit: maybe using this url https://github.com/shama/gaze/tarball/v0.6.4 in shrinkwrap would work.

Cyril CHAPON
  • 3,556
  • 4
  • 22
  • 40