Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I have npm as dependency in package.json?

Tags:

node.js

npm

If you accidentally execute npm i npm it adds npm as a dependency to the package.json and adds entries to the package-lock.json.

Should I revert this? Or does it actually make sense to have npm as dependency in the package.json?

like image 591
el-lugy Avatar asked Jun 10 '18 18:06

el-lugy


1 Answers

npm or other package managers are meant to be installed globally.

If you wish to specify the minimum npm version for your project, you could add this to package.json

"engines" : {
  "npm" : ">=x.x.x"
}
like image 174
kit Avatar answered Oct 07 '22 22:10

kit