npm-prefix.1 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. .TH "NPM-PREFIX" "1" "March 2026" "NPM@11.12.0" ""
  2. .SH "NAME"
  3. \fBnpm-prefix\fR - Display prefix
  4. .SS "Synopsis"
  5. .P
  6. .RS 2
  7. .nf
  8. npm prefix
  9. .fi
  10. .RE
  11. .P
  12. Note: This command is unaware of workspaces.
  13. .SS "Description"
  14. .P
  15. Print the local prefix to standard output. This is the closest parent directory to contain a \fBpackage.json\fR file or \fBnode_modules\fR directory, unless \fB-g\fR is also specified.
  16. .P
  17. If \fB-g\fR is specified, this will be the value of the global prefix. See npm help config for more detail.
  18. .SS "Example"
  19. .P
  20. .RS 2
  21. .nf
  22. npm prefix
  23. /usr/local/projects/foo
  24. .fi
  25. .RE
  26. .P
  27. .RS 2
  28. .nf
  29. npm prefix -g
  30. /usr/local
  31. .fi
  32. .RE
  33. .SS "Configuration"
  34. .SS "\fBglobal\fR"
  35. .RS 0
  36. .IP \(bu 4
  37. Default: false
  38. .IP \(bu 4
  39. Type: Boolean
  40. .RE 0
  41. .P
  42. 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.
  43. .RS 0
  44. .IP \(bu 4
  45. packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory.
  46. .IP \(bu 4
  47. bin files are linked to \fB{prefix}/bin\fR
  48. .IP \(bu 4
  49. man pages are linked to \fB{prefix}/share/man\fR
  50. .RE 0
  51. .SS "See Also"
  52. .RS 0
  53. .IP \(bu 4
  54. npm help root
  55. .IP \(bu 4
  56. npm help folders
  57. .IP \(bu 4
  58. npm help config
  59. .IP \(bu 4
  60. npm help npmrc
  61. .RE 0