← 返回命令列表

Linux command

npm-explore 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Explore package directory

npm explore [package-name]

Run command in package

npm explore [package-name] -- [ls]

Explore and run script

npm explore [package-name] -- npm run build

说明

npm explore spawns a subshell inside the directory of an installed package (typically under node_modules). It is useful for inspecting an installed package, manipulating git submodules within it, or running ad-hoc commands such as npm run scripts in the package context. If you modify the package while exploring, the package is not rebuilt automatically — run npm rebuild _pkg_ afterwards to recompile native components and re-link binaries.

参数

--shell _PATH_
Shell to invoke. Default: $SHELL, or bash on POSIX, or cmd.exe on Windows.

FAQ

What is the npm-explore command used for?

npm explore spawns a subshell inside the directory of an installed package (typically under node_modules). It is useful for inspecting an installed package, manipulating git submodules within it, or running ad-hoc commands such as npm run scripts in the package context. If you modify the package while exploring, the package is not rebuilt automatically — run npm rebuild _pkg_ afterwards to recompile native components and re-link binaries.

How do I run a basic npm-explore example?

Run `npm explore [package-name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --shell _PATH_ do in npm-explore?

Shell to invoke. Default: $SHELL, or bash on POSIX, or cmd.exe on Windows.