What is dependency in package.json - nodejs
The dependencies
value is used to specify any other modules that a given module (represented by the package.json
) requires to work. When you run npm install
from the root folder of a given module, it will install any modules listed in that dependencies
hash.
If you didn't get any errors with redis: 10000
listed in there, my guess is that you never ran npm install
, and therefore it never even tried to install redis. In turn, if your code is working fine without having run npm install
, most likely your code doesn't even need redis in the first place, and that item should be removed from the dependencies
hash.
While not every entry in the package.json
is essential to understand for day-to-day development, dependencies
is definitely important to be aware of. I would recommend reading through the dependencies section on the npm website.
Dependencies are nothing but it is a third party package or we can say that modules installed using npm. EX.
{
"name": "abc",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"npm",
"npm@latest",
"-gnpm",
"npm@latest",
"-gnpm",
"npm@latest",
"-g"
],
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.17.1", //THIS IS THIRD PARTY PACKAGE/MODULES
"jade": "^1.11.0",
"nano": "^8.2.2"
}
}