how to install node js dependencies from package.json
Open a terminal or command prompt.
Navigate to the root directory of your Node.js project using the
cd
command.Run the following command to install the dependencies listed in your package.json file:
bash
npm install
This command reads the dependencies from the package.json file and installs them in the node_modules
directory.
- Wait for the installation process to complete. npm will display progress messages and a summary of the installed packages.
Note: You can add the -g
flag after npm install
to install the packages globally if they are intended for global use.
That's it! Your Node.js project's dependencies are now installed and ready to use.