当前位置: 首页 > 工具软件 > npx > 使用案例 >

什么是npx(官方文档权威解读)

林弘文
2023-12-01

npx

What is NPX?

NPX is an NPM package executor. Initially, NPX was launched in July 2017. NPX was just an NPM package that could be installed like other NPM packages. Currently, NPX is bundled with NPM when you install the NPM version 5.2.0 or higher.

Using NPX

With NPX, you can run and execute packages without having to install them locally or globally.

When running NPM executables with NPX, if a package is installed, NPX will search for the package binaries (either locally or globally) and then run the package.

If the package was not previously installed, NPX will not install the package in your system; instead, it will create a temporary cache that will hold the package binaries. Once the execution is over, NPX will remove the installed cache binaries from the system.

中文翻译:

什么是NPX?

NPX是NPM包的执行者。最初,NPX于2017年7月推出.NPX只是一个可以像其他NPM软件包一样安装的NPM软件包。目前,在安装NPM 5.2.0或更高版本时,NPX与NPM捆绑在一起。

使用NPX

使用NPX,您可以运行和执行软件包,而无需在本地或全局安装它们。

使用NPX运行NPM可执行文件时,如果安装了包,NPX将搜索包二进制文件(本地或全局),然后运行包。

如果之前未安装该软件包,NPX将不会在您的系统中安装该软件包;相反,它将创建一个临时缓存来保存包二进制文件。一旦执行结束,NPX将从系统中删除已安装的缓存二进制文件。

 类似资料: