You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 1.7KB

4 lat temu
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # global-dirs
  2. > Get the directory of globally installed packages and binaries
  3. Uses the same resolution logic as `npm` and `yarn`.
  4. ## Install
  5. ```
  6. $ npm install global-dirs
  7. ```
  8. ## Usage
  9. ```js
  10. const globalDirectories = require('global-dirs');
  11. console.log(globalDirectories.npm.prefix);
  12. //=> '/usr/local'
  13. console.log(globalDirectories.npm.packages);
  14. //=> '/usr/local/lib/node_modules'
  15. console.log(globalDirectories.npm.binaries);
  16. //=> '/usr/local/bin'
  17. console.log(globalDirectories.yarn.packages);
  18. //=> '/Users/sindresorhus/.config/yarn/global/node_modules'
  19. ```
  20. ## API
  21. ### globalDirectories
  22. #### npm
  23. #### yarn
  24. ##### packages
  25. Directory with globally installed packages.
  26. Equivalent to `npm root --global`.
  27. ##### binaries
  28. Directory with globally installed binaries.
  29. Equivalent to `npm bin --global`.
  30. ##### prefix
  31. Directory with directories for packages and binaries. You probably want either of the above.
  32. Equivalent to `npm prefix --global`.
  33. ## Related
  34. - [import-global](https://github.com/sindresorhus/import-global) - Import a globally installed module
  35. - [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module
  36. - [is-installed-globally](https://github.com/sindresorhus/is-installed-globally) - Check if your package was installed globally
  37. ---
  38. <div align="center">
  39. <b>
  40. <a href="https://tidelift.com/subscription/pkg/npm-global-dirs?utm_source=npm-global-dirs&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
  41. </b>
  42. <br>
  43. <sub>
  44. Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
  45. </sub>
  46. </div>