<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>http://wiki.eijux.com/index.php?action=history&amp;feed=atom&amp;title=Node.js%EF%BC%9ANPX</id>
	<title>Node.js：NPX - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.eijux.com/index.php?action=history&amp;feed=atom&amp;title=Node.js%EF%BC%9ANPX"/>
	<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=Node.js%EF%BC%9ANPX&amp;action=history"/>
	<updated>2026-05-09T17:00:54Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.38.2</generator>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=Node.js%EF%BC%9ANPX&amp;diff=6577&amp;oldid=prev</id>
		<title>Eijux：​/* 不使用 npx 时 */</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=Node.js%EF%BC%9ANPX&amp;diff=6577&amp;oldid=prev"/>
		<updated>2023-04-01T07:34:45Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;不使用 npx 时&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2023年4月1日 (六) 15:34的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l45&quot;&gt;第45行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第45行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   ➜  press h to show help&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   ➜  press h to show help&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;##* '''&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;必须在项目目录中，且 &lt;/del&gt;&amp;lt;code&amp;gt;dev&amp;lt;/code&amp;gt;是在 package.json &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;中设置的别名&lt;/del&gt;'''&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;##* &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;code&amp;gt;&amp;lt;span style=&amp;quot;color: green&amp;quot;&amp;gt;'''npm run'''&amp;lt;/span&amp;gt;&amp;lt;/code&amp;gt; 是 &amp;lt;code&amp;gt;&amp;lt;span style=&amp;quot;color: green&amp;quot;&amp;gt;'''npm run-script'''&amp;lt;/span&amp;gt;&amp;lt;/code&amp;gt; 的缩写，&lt;/ins&gt;'''&amp;lt;code&amp;gt;dev&amp;lt;/code&amp;gt;是在 package.json &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;中设置的脚本别名&lt;/ins&gt;'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;##* '''不能直接使用 &amp;lt;code&amp;gt;npm run vite&amp;lt;/code&amp;gt;'''：&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;##* '''不能直接使用 &amp;lt;code&amp;gt;npm run vite&amp;lt;/code&amp;gt;'''：&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;##*: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;##*: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=Node.js%EF%BC%9ANPX&amp;diff=6569&amp;oldid=prev</id>
		<title>2023年3月31日 (五) 18:42 Eijux</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=Node.js%EF%BC%9ANPX&amp;diff=6569&amp;oldid=prev"/>
		<updated>2023-03-31T18:42:26Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2023年4月1日 (六) 02:42的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l2&quot;&gt;第2行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第2行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 关于 ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 关于 ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &amp;lt;span style=&amp;quot;color: blue&amp;quot;&amp;gt;npx&amp;lt;/span&amp;gt; 是“&amp;lt;span style=&amp;quot;color: blue&amp;quot;&amp;gt;Node 包执行器&amp;lt;/span&amp;gt;”（&amp;lt;span style=&amp;quot;color: green&amp;quot;&amp;gt;npm&amp;lt;/span&amp;gt; 是“&amp;lt;span style=&amp;quot;color: green&amp;quot;&amp;gt;Node 包管理器&amp;lt;/span&amp;gt;”）&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &amp;lt;span style=&amp;quot;color: blue&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;; font-size: 150%&lt;/ins&gt;&amp;quot;&amp;gt;npx&amp;lt;/span&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;gt;&amp;lt;ref&amp;gt;参考：[https://docs.npmjs.com/cli/v7/commands/npx npx：Run a command from a local or remote npm package]&amp;lt;/ref&lt;/ins&gt;&amp;gt; 是“&amp;lt;span style=&amp;quot;color: blue&amp;quot;&amp;gt;Node 包执行器&amp;lt;/span&amp;gt;”（&amp;lt;span style=&amp;quot;color: green&amp;quot;&amp;gt;npm&amp;lt;/span&amp;gt; 是“&amp;lt;span style=&amp;quot;color: green&amp;quot;&amp;gt;Node 包管理器&amp;lt;/span&amp;gt;”）&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  —— NPM 执行 Node 包：必须是本地安装的包，并通过定位本地路径或者配置 scripts 来执行。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  —— NPM 执行 Node 包：必须是本地安装的包，并通过定位本地路径或者配置 scripts 来执行。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  —— NPX &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;既可以运行本地包，也可以远程包，无需安装包也可以执行该包。&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  —— NPX &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;可以运行本地包和远程包，能自动定位或安装。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;NPX 用于执行 Node 包：&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;NPX 用于执行 Node 包：&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l89&quot;&gt;第89行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第90行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* '''自动定位并执行项目内部安装的模块'''。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* '''自动定位并执行项目内部安装的模块'''。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== 参考 ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;references/&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=Node.js%EF%BC%9ANPX&amp;diff=6568&amp;oldid=prev</id>
		<title>Eijux：​创建页面，内容为“category:Node.js  == 关于 ==  &lt;span style=&quot;color: blue&quot;&gt;npx&lt;/span&gt; 是“&lt;span style=&quot;color: blue&quot;&gt;Node 包执行器&lt;/span&gt;”（&lt;span style=&quot;color: green&quot;&gt;npm&lt;/span&gt; 是“&lt;span style=&quot;color: green&quot;&gt;Node 包管理器&lt;/span&gt;”）    —— NPM 执行 Node 包：必须是本地安装的包，并通过定位本地路径或者配置 scripts 来执行。  —— NPX 既可以运行本地包，也可以远程包，无需安装包也可以执行该包。  NPX…”</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=Node.js%EF%BC%9ANPX&amp;diff=6568&amp;oldid=prev"/>
		<updated>2023-03-31T18:38:53Z</updated>

		<summary type="html">&lt;p&gt;创建页面，内容为“&lt;a href=&quot;/%E5%88%86%E7%B1%BB:Node.js&quot; title=&quot;分类:Node.js&quot;&gt;category:Node.js&lt;/a&gt;  == 关于 ==  &amp;lt;span style=&amp;quot;color: blue&amp;quot;&amp;gt;npx&amp;lt;/span&amp;gt; 是“&amp;lt;span style=&amp;quot;color: blue&amp;quot;&amp;gt;Node 包执行器&amp;lt;/span&amp;gt;”（&amp;lt;span style=&amp;quot;color: green&amp;quot;&amp;gt;npm&amp;lt;/span&amp;gt; 是“&amp;lt;span style=&amp;quot;color: green&amp;quot;&amp;gt;Node 包管理器&amp;lt;/span&amp;gt;”）    —— NPM 执行 Node 包：必须是本地安装的包，并通过定位本地路径或者配置 scripts 来执行。  —— NPX 既可以运行本地包，也可以远程包，无需安装包也可以执行该包。  NPX…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[category:Node.js]]&lt;br /&gt;
&lt;br /&gt;
== 关于 ==&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue&amp;quot;&amp;gt;npx&amp;lt;/span&amp;gt; 是“&amp;lt;span style=&amp;quot;color: blue&amp;quot;&amp;gt;Node 包执行器&amp;lt;/span&amp;gt;”（&amp;lt;span style=&amp;quot;color: green&amp;quot;&amp;gt;npm&amp;lt;/span&amp;gt; 是“&amp;lt;span style=&amp;quot;color: green&amp;quot;&amp;gt;Node 包管理器&amp;lt;/span&amp;gt;”）&lt;br /&gt;
 &lt;br /&gt;
 —— NPM 执行 Node 包：必须是本地安装的包，并通过定位本地路径或者配置 scripts 来执行。&lt;br /&gt;
 —— NPX 既可以运行本地包，也可以远程包，无需安装包也可以执行该包。&lt;br /&gt;
&lt;br /&gt;
NPX 用于执行 Node 包：&lt;br /&gt;
# 执行本地 Node 包时，NPX 会到 '''&amp;lt;code&amp;gt;node_modules/.bin&amp;lt;/code&amp;gt;''' 路径和 &amp;lt;code&amp;gt;环境变量 $PATH&amp;lt;/code&amp;gt; 里面，检查命令是否存在。&lt;br /&gt;
# 执行远程 Node 包时，NPX 会将 Node 包&amp;lt;code&amp;gt;下载到一个临时目录&amp;lt;/code&amp;gt;中，使用以后再删除。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
其目的就是让'''项目内部安装的模块'''用起来更方便。&lt;br /&gt;
&lt;br /&gt;
== 示例 ==&lt;br /&gt;
 以下以 vite 为例，可以体会 npx 的方便之处。&lt;br /&gt;
&lt;br /&gt;
=== '''不使用 npx 时''' ===&lt;br /&gt;
# 全局安装的 vite 可以直接运行：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
PS C:\Users\eijux&amp;gt; vite&lt;br /&gt;
&lt;br /&gt;
  VITE v4.2.1  ready in 13186 ms&lt;br /&gt;
&lt;br /&gt;
  ➜  Local:   http://localhost:5173/&lt;br /&gt;
  ➜  Network: use --host to expose&lt;br /&gt;
  ➜  press h to show help&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# 局部安装的 vite（项目依赖）：&lt;br /&gt;
## 项目目录中，通过 '''npm''' 命令运行：&lt;br /&gt;
##: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
PS D:\Documents\VSCode\VueDemo&amp;gt; npm run dev&lt;br /&gt;
&lt;br /&gt;
&amp;gt; vuedemo@0.0.0 dev&lt;br /&gt;
&amp;gt; vite&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  VITE v4.2.1  ready in 663 ms&lt;br /&gt;
&lt;br /&gt;
  ➜  Local:   http://localhost:5173/&lt;br /&gt;
  ➜  Network: use --host to expose&lt;br /&gt;
  ➜  press h to show help&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
##* '''必须在项目目录中，且 &amp;lt;code&amp;gt;dev&amp;lt;/code&amp;gt;是在 package.json 中设置的别名'''&lt;br /&gt;
##* '''不能直接使用 &amp;lt;code&amp;gt;npm run vite&amp;lt;/code&amp;gt;'''：&lt;br /&gt;
##*: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
D:\Documents\VSCode\VueDemo&amp;gt;npm run vite&lt;br /&gt;
npm ERR! Missing script: &amp;quot;vite&amp;quot;&lt;br /&gt;
npm ERR!&lt;br /&gt;
npm ERR! To see a list of scripts, run:&lt;br /&gt;
npm ERR!   npm run&lt;br /&gt;
&lt;br /&gt;
npm ERR! A complete log of this run can be found in:&lt;br /&gt;
npm ERR!     C:\Users\eijux\AppData\Local\npm-cache\_logs\2023-03-31T18_27_23_208Z-debug-0.log&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
## 项目依赖包可执行目录中，通过 &amp;lt;code&amp;gt;.\vite.cmd&amp;lt;/code&amp;gt; 运行：&lt;br /&gt;
##: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;1,2&amp;quot;&amp;gt;&lt;br /&gt;
PS D:\Documents\VSCode\VueDemo\node_modules\.bin&amp;gt; .\vite.cmd&lt;br /&gt;
(!) Could not auto-determine entry point from rollupOptions or html files and there are no explicit optimizeDeps.include patterns. Skipping dependency pre-bundling.&lt;br /&gt;
&lt;br /&gt;
  ➜  Local:   http://localhost:5173/&lt;br /&gt;
  ➜  Network: use --host to expose&lt;br /&gt;
  ➜  press h to show help&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
##* 这种方式，'''无法确定项目入口点，不能用于运行项目！'''&lt;br /&gt;
## 在 VSCode 等编辑器中运行：&lt;br /&gt;
##: [[File:VSCode中运行vite.png|400px]]&lt;br /&gt;
&lt;br /&gt;
=== 使用 npx ===&lt;br /&gt;
# 在非项目目录运行：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;1-4&amp;quot;&amp;gt;&lt;br /&gt;
PS C:\Users\eijux&amp;gt; npx vite&lt;br /&gt;
Need to install the following packages:&lt;br /&gt;
  vite@4.2.1&lt;br /&gt;
Ok to proceed? (y) n&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#* 如果在 '''&amp;lt;code&amp;gt;环境变量 $PATH&amp;lt;/code&amp;gt;''' 不能找到相关命令地址（未安装），则会提示安装。&lt;br /&gt;
# 在项目目录中运行：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; highlight=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
D:\Documents\VSCode\VueDemo&amp;gt;npx vite&lt;br /&gt;
&lt;br /&gt;
  VITE v4.2.1  ready in 693 ms&lt;br /&gt;
&lt;br /&gt;
  ➜  Local:   http://localhost:5173/&lt;br /&gt;
  ➜  Network: use --host to expose&lt;br /&gt;
  ➜  press h to show help&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#* '''自动定位并执行项目内部安装的模块'''。&lt;/div&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
</feed>