I am creating a Node module with devDependencies, which must be installed globally, for example, jasmine-node and jshint. Essentially, I need to be able to reference my binaries in the makefile / npm script section to run tests, lint, etc. In other words, I do not want () to program them programmatically.
After digging, I was still confused about how to handle this:
1). My first approach was to assume that these modules will be installed globally, check this in my module documentation and specify their binaries as global variables - i.e. expect them to be available worldwide. This contradicts this recommendation.
Make sure you avoid referencing globally installed binaries. Instead, point it to a local node_modules that installs binaries in the hidden .bin directory. Make sure the module (in this case "mocha") is in your package. Json is under devDependencies, so the binary is put there when you run npm install.
(taken from this post )
This usually sounds correct, as the above setting is rather fragile.
2) My next approach was explicitly included in these modules in devDependencies (although they are still globally installed on my system (and, most likely, on user and developer systems). This ensures that suitable binary versions are available when necessary, and now I can reference them through node_modules/.bin/ .
However, I am now in conflict with this advice.
Install it locally if you want () it.
(taken from npm docs )
Regardless, I notice that npm install now actually prints nothing (displays network activity) for global modules.
My questions:
- Are local versions of global modules (mentioned in devDependencies) only snapshots (copies) of global ones taken during
npm install ? - Is there 2) the right way to do this? or is there some other practice i'm missing?