← 返回命令列表

Linux command

npx 命令

文本

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

常用示例

Run package command

npx [package-name]

Run specific version

npx [package]@[version]

Run without installing

npx --no-install [package]

Run with arguments

npx [create-react-app] [my-app]

Run from GitHub

npx github:[user]/[repo]

Run local binary

npx [./node_modules/.bin/command]

Execute package command

npx -p [package] -c "[command]"

说明

npx executes npm package binaries. It first checks local node_modules/.bin, then globally installed packages, and finally downloads the package temporarily if not found. Common uses include running project scaffolding tools (create-react-app, create-next-app), one-off utilities, and testing different package versions without installing them globally.

参数

--no-install
Don't install missing.
-p _PKG_
Package to install.
-c _CMD_
Command to run.
-y, --yes
Automatically confirm prompts.
--help
Display help information.

FAQ

What is the npx command used for?

npx executes npm package binaries. It first checks local node_modules/.bin, then globally installed packages, and finally downloads the package temporarily if not found. Common uses include running project scaffolding tools (create-react-app, create-next-app), one-off utilities, and testing different package versions without installing them globally.

How do I run a basic npx example?

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

What does --no-install do in npx?

Don't install missing.