Learning about node modules and their location with npm
Npm - Node Package Manager - provides some very useful commands for learning about global node modules and where they are stored on the operating system directory tree. This knowledge proves very useful, while juggling Node and npm installations or for testing your new setup looks and works the way it was meant to.
To learn where exactly your node modules are stored, run:
npm root -g
To find out where executables for global node packages are stored, type:
npm bin -g
To list all global packages, type:
npm list -g
To check if a specific module, like yarn, is installed globally type:
npm list yarn -g
To learn details about a node module, like yarn, run:
npm pack yarn -g
To find documentation for a module like yarn, type:
npm docs yarn
This command will open a new web browser tab and load the module's description page on Github. Alternatively you can do this:
npm repo yarn
That's it. I hope the commands will help you to master you Node modules better.
This post was updated on 08 Jan 2022 17:14:57
Author, Copyright and citation
Author of the this article - Sylwester Wojnowski - is a sWWW web developer. He has been writing computer code for the websites and web applications since 1998.
©Copyright, 2024 Sylwester Wojnowski. This article may not be reproduced or published as a whole or in parts without permission from the author. If you share it, please give author credit and do not remove embedded links.
Computer code, if present in the article, is excluded from the above and licensed under GPLv3.
Cite this article as:
Wojnowski, Sylwester. "Learning about node modules and their location with npm." From sWWW - Code For The Web . https://swww.com.pl//main/index/learning-about-node-modules-and-their-location-with-npm