I saw this somewhere, inside package.json:
"dependencies": {
...,
"npm": "^6.1.0",
...
}
Is there any point in this?
Will npm update itself as a result of this?
If yes, will it be able to do so if its current version is lower than 6?
I saw this somewhere, inside package.json:
"dependencies": {
...,
"npm": "^6.1.0",
...
}
Is there any point in this?
Will npm update itself as a result of this?
If yes, will it be able to do so if its current version is lower than 6?
This is not the normal practice for packages. This will not affect your global installation of npm.
If you wish to specify which version of npm your package requires to be installed, the engines field in the package.json is the proper place to put it. From the npm docs:
You can also use the “engines” field to specify which versions of npm are capable of properly installing your program. For example:
{ "engines" : { "npm" : "~1.0.20" } }Unless the user has set the
engine-strictconfig flag, this field is advisory only and will only produce warnings when your package is installed as a dependency.
npm will not prevent installation of packages with a different version of npm listed in engines, but it will warn in the console that it's requesting a different version of npm than what you're using.
The only purpose of installing npm as a dependency would be if it's a package that somehow needs to use npm's API directly (like a node_modules/ analyzer, or something like that).