Skip to content

Commit f36a4ed

Browse files
committed
docs: add --no flag to npx command to avoid downloading the incorrect package from npm
Thanks to @alxndrsn for finding this issue and the insightful blog post. https://www.alxndrsn.com/2024-08-01-npx-binary-confusion/ Also thanks to @lirantal for his newsletter that brought this issue to my attention. https://www.nodejs-security.com/newsletter/npm-supply-chain-security-prisma-orm-security-fun-nodejs-security-challenges
1 parent cb4477f commit f36a4ed

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

docs/guide/cli-service.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ yarn serve
2626
If you have [npx](https://github.com/npm/npx) available (should be bundled with an up-to-date version of npm), you can also invoke the binary directly with:
2727

2828
```bash
29-
npx vue-cli-service serve
29+
npx --no vue-cli-service serve
3030
```
3131

3232
::: tip
@@ -114,21 +114,21 @@ You can use `vue-cli-service inspect` to inspect the webpack config inside a Vue
114114
Some CLI plugins will inject additional commands to `vue-cli-service`. For example, `@vue/cli-plugin-eslint` injects the `vue-cli-service lint` command. You can see all injected commands by running:
115115

116116
```bash
117-
npx vue-cli-service help
117+
npx --no vue-cli-service help
118118
```
119119

120120
You can also learn about the available options of each command with:
121121

122122
```bash
123-
npx vue-cli-service help [command]
123+
npx --no vue-cli-service help [command]
124124
```
125125

126126
## Skipping Plugins
127127

128128
You can exclude specific plugins when running a command by passing the name of the plugin to the `--skip-plugins` option:
129129

130130
```bash
131-
npx vue-cli-service build --skip-plugins pwa
131+
npx --no vue-cli-service build --skip-plugins pwa
132132
```
133133

134134
::: tip
@@ -138,18 +138,18 @@ This option is available for _every_ `vue-cli-service` command, including custom
138138
You can skip multiple plugins by passing their names as a comma-separated list or by repeating the argument:
139139

140140
```bash
141-
npx vue-cli-service build --skip-plugins pwa,apollo --skip-plugins eslint
141+
npx --no vue-cli-service build --skip-plugins pwa,apollo --skip-plugins eslint
142142
```
143143

144144
Plugin names are resolved the same way they are during install, as described [here](./plugins-and-presets.md#installing-plugins-in-an-existing-project)
145145

146146
```bash
147147
# these are all equivalent
148-
npx vue-cli-service build --skip-plugins pwa
148+
npx --no vue-cli-service build --skip-plugins pwa
149149

150-
npx vue-cli-service build --skip-plugins @vue/pwa
150+
npx --no vue-cli-service build --skip-plugins @vue/pwa
151151

152-
npx vue-cli-service build --skip-plugins @vue/cli-plugin-pwa
152+
npx --no vue-cli-service build --skip-plugins @vue/cli-plugin-pwa
153153
```
154154

155155
## Caching and Parallelization

docs/ru/guide/cli-service.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ yarn serve
2626
Если у вас установлен [npx](https://github.com/npm/npx) (должен поставляться в комплекте с последней версией npm), то вы также можете запустить бинарник напрямую:
2727

2828
```bash
29-
npx vue-cli-service serve
29+
npx --no vue-cli-service serve
3030
```
3131

3232
::: tip Совет
@@ -114,21 +114,21 @@ npx vue-cli-service serve
114114
Некоторые плагины CLI добавляют собственные команды в `vue-cli-service`. Например, `@vue/cli-plugin-eslint` внедряет команду `vue-cli-service lint`. Вы можете посмотреть весь список команд запустив:
115115

116116
```bash
117-
npx vue-cli-service help
117+
npx --no vue-cli-service help
118118
```
119119

120120
Вы также можете узнать о доступных параметрах каждой команды с помощью:
121121

122122
```bash
123-
npx vue-cli-service help [command]
123+
npx --no vue-cli-service help [command]
124124
```
125125

126126
## Исключение плагинов при запуске
127127

128128
Можно исключить определённые плагины при запуске команды, передав имя плагина опцией `--skip-plugins`.
129129

130130
```bash
131-
npx vue-cli-service build --skip-plugins pwa
131+
npx --no vue-cli-service build --skip-plugins pwa
132132
```
133133

134134
::: tip СОВЕТ
@@ -138,16 +138,16 @@ npx vue-cli-service build --skip-plugins pwa
138138
Можно пропустить несколько подключаемых плагинов, передав их имена через запятую:
139139

140140
```bash
141-
npx vue-cli-service build --skip-plugins pwa,apollo
141+
npx --no vue-cli-service build --skip-plugins pwa,apollo
142142
```
143143

144144
Имена плагинов разрешаются также, как и при установке, что подробнее описано [здесь](./plugins-and-presets.md#установка-пnагинов-в-существующий-проект)
145145

146146
```bash
147147
# все вызовы равнозначны
148-
npx vue-cli-service build --skip-plugins pwa
149-
npx vue-cli-service build --skip-plugins @vue/pwa
150-
npx vue-cli-service build --skip-plugins @vue/cli-plugin-pwa
148+
npx --no vue-cli-service build --skip-plugins pwa
149+
npx --no vue-cli-service build --skip-plugins @vue/pwa
150+
npx --no vue-cli-service build --skip-plugins @vue/cli-plugin-pwa
151151
```
152152

153153
## Кэширование и параллелизация

docs/zh/guide/cli-service.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ yarn serve
2626
如果你可以使用 [npx](https://github.com/npm/npx) (最新版的 npm 应该已经自带),也可以直接这样调用命令:
2727

2828
```bash
29-
npx vue-cli-service serve
29+
npx --no vue-cli-service serve
3030
```
3131

3232
::: tip 提示
@@ -103,13 +103,13 @@ npx vue-cli-service serve
103103
有些 CLI 插件会向 `vue-cli-service` 注入额外的命令。例如 `@vue/cli-plugin-eslint` 会注入 `vue-cli-service lint` 命令。你可以运行以下命令查看所有注入的命令:
104104

105105
```bash
106-
npx vue-cli-service help
106+
npx --no vue-cli-service help
107107
```
108108

109109
你也可以这样学习每个命令可用的选项:
110110

111111
```bash
112-
npx vue-cli-service help [command]
112+
npx --no vue-cli-service help [command]
113113
```
114114

115115
## 缓存和并行处理

0 commit comments

Comments
 (0)