英文:
Skipping the Angular Material install prompts (Using Defaults)?
问题
这曾经可以用于在安装 Angular Material 时绕过提示:
ng add @angular/material --interactive=false
然而现在不再有效。如何跳过提示?
以下是使用 `interactive=false` 的示例命令尝试:
Would you like to proceed? (Y/n)
oleersoy@Oles-MacBook-Pro ng % ng add @angular/material --interactive=false
Node.js 版本 v19.8.1 检测到。
奇数版本的 Node.js 将不会进入 LTS 状态,不应用于生产环境。欲了解更多信息,请参阅 https://nodejs.org/en/about/releases/。
ℹ 使用的包管理器: npm
✔ 找到兼容的包版本: @angular/material@15.2.7。
✔ 载入包信息。
将安装和执行 @angular/material@15.2.7 包。
Would you like to proceed? (Y/n)
以下是使用 `--defaults` 的示例尝试:
oleersoy@Oles-MacBook-Pro ng % ng add @angular/material --defaults
Node.js 版本 v19.8.1 检测到。
奇数版本的 Node.js 将不会进入 LTS 状态,不应用于生产环境。欲了解更多信息,请参阅 https://nodejs.org/en/about/releases/。
ℹ 使用的包管理器: npm
✔ 找到兼容的包版本: @angular/material@15.2.7。
✔ 载入包信息。
将安装和执行 @angular/material@15.2.7 包。
Would you like to proceed? (Y/n)
<details>
<summary>英文:</summary>
This used to work for bypassing the prompts during an Angular Material install:
ng add @angular/material --interactive=false
However it no longer works. How do we skip the prompts?
Here's a sample command attempt using `interactive=false`:
Would you like to proceed? (Y/n)
oleersoy@Oles-MacBook-Pro ng % ng add @angular/material --interactive=false
Node.js version v19.8.1 detected.
Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/releases/.
ℹ Using package manager: npm
✔ Found compatible package version: @angular/material@15.2.7.
✔ Package information loaded.
The package @angular/material@15.2.7 will be installed and executed.
Would you like to proceed? (Y/n)
And here's a sample attempts with `--defaults`:
oleersoy@Oles-MacBook-Pro ng % ng add @angular/material --defaults
Node.js version v19.8.1 detected.
Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/releases/.
ℹ Using package manager: npm
✔ Found compatible package version: @angular/material@15.2.7.
✔ Package information loaded.
The package @angular/material@15.2.7 will be installed and executed.
Would you like to proceed? (Y/n)
</details>
# 答案1
**得分**: 2
要避免出现“是否要继续?”提示,您需要添加选项 `--skip-confirmation`。
来自[文档][1]的描述:
> 在安装和执行包之前跳过确认提示。在使用此选项之前,请确保包名称正确。
[1]: https://angular.io/cli/add#options
<details>
<summary>英文:</summary>
To avoid the "Would you like to proceed?" prompt you need to add the option `--skip-confirmation`.
Description from the [1]:
> Skip asking a confirmation prompt before installing and executing the package. Ensure package name is correct prior to using this option.
[1]: https://angular.io/cli/add#options
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论