npm-root.1 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. .TH "NPM-ROOT" "1" "March 2026" "NPM@11.12.0" ""
  2. .SH "NAME"
  3. \fBnpm-root\fR - Display npm root
  4. .SS "Synopsis"
  5. .P
  6. .RS 2
  7. .nf
  8. npm root
  9. .fi
  10. .RE
  11. .P
  12. Note: This command is unaware of workspaces.
  13. .SS "Description"
  14. .P
  15. Print the effective \fBnode_modules\fR folder to standard out.
  16. .P
  17. Useful for using npm in shell scripts that do things with the \fBnode_modules\fR folder. For example:
  18. .P
  19. .RS 2
  20. .nf
  21. #!/bin/bash
  22. global_node_modules="$(npm root --global)"
  23. echo "Global packages installed in: ${global_node_modules}"
  24. .fi
  25. .RE
  26. .SS "Configuration"
  27. .SS "\fBglobal\fR"
  28. .RS 0
  29. .IP \(bu 4
  30. Default: false
  31. .IP \(bu 4
  32. Type: Boolean
  33. .RE 0
  34. .P
  35. Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior.
  36. .RS 0
  37. .IP \(bu 4
  38. packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory.
  39. .IP \(bu 4
  40. bin files are linked to \fB{prefix}/bin\fR
  41. .IP \(bu 4
  42. man pages are linked to \fB{prefix}/share/man\fR
  43. .RE 0
  44. .SS "See Also"
  45. .RS 0
  46. .IP \(bu 4
  47. npm help prefix
  48. .IP \(bu 4
  49. npm help folders
  50. .IP \(bu 4
  51. npm help config
  52. .IP \(bu 4
  53. npm help npmrc
  54. .RE 0