Skipping the Angular Material install prompts (Using Defaults)?

huangapple go评论58阅读模式
英文:

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&#39;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&#39;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 &quot;Would you like to proceed?&quot; prompt you need to add the option `--skip-confirmation`. 

Description from the 
[1]: &gt; 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>

huangapple
  • 本文由 发表于 2023年4月17日 00:41:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/76029069.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定