Why, for example, does the Grunt plugin define its dependency on grunt as " peer dependencies "?
Why can't a plugin just have Grunt as its own dependency in grunt-plug / node_modules ?
Peer dependencies are described here: https://nodejs.org/en/blog/npm/peer-dependencies/
But I do not quite understand.
example
I am currently working with AppGyver steroids, which use Grunt tasks to assemble my source files into the / dist / folder for maintenance on a local device. I am new to npm and grunt, so I want to fully understand what is happening.
While I get this:
[rootfolder] /package.json tells npm that it depends on the nru grunt-steroids development package:
"devDependencies": { "grunt-steroids": "0.x" },
Good. Running npm install in [rootfolder] detects the dependency and installs grunt steroids in [rootfolder] / node_modules / grunt-steroids .
Npm then reads [rootfolder] /node_modules/grunt-steroids/package.json to install its own grunt-steroids dependencies:
"devDependencies": { "grunt-contrib-nodeunit": "0.3.0", "grunt": "0.4.4" }, "dependencies": { "wrench": "1.5.4", "chalk": "0.3.0", "xml2js": "0.4.1", "lodash": "2.4.1" }, "peerDependencies": { "grunt": "0.4.4", "grunt-contrib-copy": "0.5.0", "grunt-contrib-clean": "0.5.0", "grunt-contrib-concat": "0.4.0", "grunt-contrib-coffee": "0.10.1", "grunt-contrib-sass": "0.7.3", "grunt-extend-config": "0.9.2" },
Dependency packages are installed in [rootfolder] / node_modules / grunt-steroids / node_modules, which is logical for me.
" DevDependencies " are not installed, which I am sure is controlled by npm, which detects that I am just trying to use grunt-steroids and not develop on it.
But then we have " mutual dependencies ."
They are installed in [rootfolder] / node_modules , and I donβt understand why there, and not in [rootfolder] / node_modules / grunt-steroids / node_modules, in order to avoid conflicts with other plugins (or something else)?