Difference Between a Npm Dependency & devDependencies
When installing and using the Node Package Manager (Npm), what is the difference between
- "dependency": Packages that are needed for your application to work in production.
- "devDepencency": Packages that are only needed in your local development or testing.
This command will install a package as a
npm install <package-name> --save
After installing a package using one of those commands, it will be added to the
"dependencies" list in your
And to install a package as a
npm install <package-name> --save-dev
This will add the package to the
"devDependencies" list in your package.json file.
Now when you run the
npm install command in the root of your project directory, it will install all of the packages in both the
"devDependencies" lists in your
If you want to only install the
"dependencies" and not the
"devDependencies" packages, you can set the