Learn Package.json in Deatils

Learn Package.json in Deatils

Package.json file is the most important file in ReactJS. Package.json file is not only present in ReactJS but also available in Vue.js and AngularJS also.

What is Package.json?

All details of the project are available in the Package.json file. For example:- name, version, dependencies, which commands we used in this project, library.

Why do we not push node modules in Git?

Because of its size, it is very heavy. Any developer can easily install or add node modules in their project using the run npm install (npm i ) command using the command line.

How to add a new npm package?

Write the command line npm install (package name) and hit the enter button Your package was installed very easily in another way Also add the package to your project go to Package.json file and write "package name":"^version" then in the command line run nmp install command.

How to remove any package from your project?

In the command line run npm uninstall (package name) and hit the enter button Your package was uninstalled very easily in another way remove the package from your project go to the package.json file and remove "package name":"^version" Then in the command line run nmp install command.

How to replace the npm start command with another one?

Step 1: Go to the Package.json file.

Step 2: Find scripts and inside it replace the "start" word with another one for example "reactapp".

Step 3: Then save it. And in the terminal, you can write npm run reactapp. Then hit enter your project was run.