Using NPM is quite straightforward. It comes bundled with Node.js installations so make sure to install Node.js first. To verify if it's installed correctly, simply run
node -v and
npm -v in your terminal. Both commands should return version numbers. Once set up, you can begin using NPM by including
npm followed by the desired command in your terminal. For instance, to install a package, you would use
npm install <package-name>. This code utilises the
install command to download the specified package. Similarly, you can remove packages with
npm uninstall <package-name>, update with
npm update <package-name> and so forth.
# install a package
npm install <package-name>
# remove a package
npm uninstall <package-name>
# update a package
npm update <package-name>
The official NPM documentation, an extensive repository of guides, how-tos, and reference materials around the functionalities of NPM, can be found at https://docs.npmjs.com/. Users can find information varying from introduction to advanced topics, aiding both beginners and experienced developers in mastering the tool. This documentation is the central place for knowledge and advice on all things NPM, from installing packages to troubleshooting errors. Finally, remember that you can also search the docs locally with the command
npm help-search <query>.