npm Cheat Sheet/Show package root

Print the nearest package root path.

Section: package.json editing

Show package root

bash
bash
npm prefix
Explanation

Print the nearest package root path.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing package.json editing
Show node_modules root
Print the local node_modules directory.
OpenIn sheetbashsame section
Get a package.json field
Read a field from package.json.
OpenIn sheetbashsame section
Set a package.json field
Write a field to package.json.
OpenIn sheetbashsame section
Delete a package.json field
Remove a field from package.json.
OpenIn sheetbashsame section
Show npm help
Open npm help.
OpenIn sheetbash1 tag match
List installed packages
Show installed dependency tree.
OpenIn sheetbash1 tag match