×

difference between Dependency and DevDependencies

Introduction

There is a file named package.json present in every web project. It contains all the data needed for the project, which is also called metadata. All the dependencies needed for this project are present in that file. There are three types of dependencies present in that file. We are going to learn about only dependencies, and dev dependencies.

The following commands are used to run the projects:

npm init -y
{
“name”: “demo”,
“version”: “1.0.0”,
“main”: “index.js”,
“scripts” :{
 “tests”: “echo” Error: no test specified” && exit 1 “
},
“author”: “”,
“license”: “ICS”,
“keyword”: [],
“description”: “”
}

Dependencies

There is an object called dependencies in the file project.json. It contains all the related information needed for the web development project, including the version name. So whenever we install the library file for any project, we must find the project.json file. 

Syntax:  

npm install 

We can install the project by using the following command:

npm install moment

After the module installation is complete then we can start the structure of the package.json file by using the following command:

“dependencies”: {
“moment”: “2.23.0”
},

DevDependencies

There is an object called dev dependencies in the file project.json. It contains all the related information that is used for the development proposal. So whenever we install the development file for any project, we must find the project.json file. 

We can add more dev dependencies files by using the following command.

npm install  --save-dev

Example

We can install the bootstrap module that is used only for development proposed by using the following command.

npm install bootstrap --save-dev

After completion of the installation of the bootstrap package, then we can start the installation of the version of the package.json file by using the following command.

“devDependencies”: {
“bootstrap”: “4.3.1”
},

Now we can summarize the difference between dependencies and dev dependencies below.

Dependencies vs. devDependencies

Dependencies devDependencies
It is a library package that is used for the project to need to function effectively. It is a development package for the project to the project’s development.
If a package does not have any node file, then it automatically adds the node file. If we install the npm package, then dev dependencies automatically installs all the required files.
When we run the program, then these library files are needed. These packages are needed during the development phase, not in the execution phase.
The package includes the final code. It also includes the final code.
Dependencies can be added to your project by running the below command. npm install   Dev dependencies can be added to your project by running the below command. npm install --save-dev  

Related Topics

Difference between EMF and Potential Difference

Introduction EMF and Potential Difference are one of the major terms used in the electric circuits and widely used to know the voltages of the current passing in the circuit or...

3 minutes read.

Difference between Backtracking and Recursion

What is Backtracking? Backtracking is a process that helps to solve the problem recursively. In other words, backtracking is an algorithm that solves the problem. It uses a recursive function to...

6 minutes read.

Difference between Elasticity and Plasticity

Introduction According to the law of Laymans, some substances return to their original form after being stretched. We have also done the experiment by using a slingshot. Slingshot is a substance...

4 minutes read.

Difference between Real and Virtual Image

Difference between Real and Virtual Image We are able to see the beautiful world around us. We can read a book, watch TV as well as see our image in the...

5 minutes read.

Difference between Forward Engineering and Reverse Engineering

Forward engineering and Reverse engineering are part of the re-engineering process. The primary difference between forward engineering and reverse engineering is that forward uses the reconfiguration of the subject system....

4 minutes read.

difference between Dependency and DevDependencies

Introduction There is a file named package.json present in every web project. It contains all the data needed for the project, which is also called metadata. All the dependencies needed for...

2 minutes read.

Difference between ASCII and Unicode

Introduction In this article, we are going to learn about the differences between ASCII and Unicode. We are going to study briefly about these two topics and study about major differences...

3 minutes read.

Difference between GPS and DGPS

What is GPS, and how is it operated? Positioning and navigation are become crucial aspects of our daily lives. Today, GPS is the most widely used utility for everyone. A person...

3 minutes read.

Difference between Metrics, KPI's and Critical results

Usually, people use these terms, metrics, KPI’s and key results interchangeably as if they all mean the same, but these are different terms. So, let's learn these with transparency. Metrics The word...

3 minutes read.

Difference between Subnetting and Supernetting

In this article, we are going to study about the Subnetting and Supernetting. We are going to see the differences between Subnetting and Supernetting. Both Subnetting and Supernetting are related...

3 minutes read.

Difference between Molecules and Compounds

Molecule A molecule is a group of two or more atoms that are joined together, showing the smallest identifiable unit where the pure substance can hold its compositions chemical properties. The...

3 minutes read.

Democrat vs Republican

Difference between Democrat and Republican In the United States, the election structure is known as a two-party system. It denotes that two parties, namely Republican Party and the Democratic Party, which...

3 minutes read.

Difference between Raspberry Pi and Beaglebone Black

Raspberry Pi Raspberry Pi is a mini computer that fits in the palm of a hand with a price tag as low as five dollars, the idea was born in 2006,...

2 minutes read.

Difference Between Orbits and Orbitals Atom

Difference Between Orbits and Orbitals Atom: Everything around you is made up by atoms. Atom is the smallest unit of element. It is a Greek word which means Indivisible. Atom can’t be...

9 minutes read.

Difference between RIP and EIGRP

1. Routing Information Protocol (RIP) In the Routing Information Protocol (RIP), 15 hops are allowed at most because it avoids source-to-destination routing loops. Erroneous or incorrect routing information is avoided using...

2 minutes read.

Difference between Physical Change and Chemical Change

Difference between Physical Change and Chemical Change There is a famous quote by Heraclitus, “Change is the only Constant.” This entire universe is working on the single concept that is Change. From seed...

4 minutes read.

Difference between Full Stack Developer and Software Developer

Full Stack Developer A full stack developer is responsible for managing both the visible front end and the infrastructure supporting the back end of a website as well as the development...

3 minutes read.

Difference between Audit and Review

Audit Vs Review Business entrepreneurs look for different options to save their time and money when it comes to financial statements. Both the methods: Audit and Review, is used for the...

4 minutes read.

Difference between AT Motherboard and ATX Motherboard

Motherboard is an important and essential part of a PC. Motherboard plays an important role in the working of a PC. It includes many circuits and slots which contain many...

3 minutes read.

Difference between Guidance and Counseling

Guidance meaning Guidance is the direction or advice given to a person by an expert or certified individual in a particular department. In other words, guidance means the action where an...

3 minutes read.