# Electron 版本说明

如果你是一个经验丰富的Node开发人员，你肯定知道 `semver`或者[Semantic Versioning](http://semver.org)-也就是语义版本,即软件版本号的发布惯例。

## 语义版本控制概述

语义版本总是由三个数字组成：

```
major.minor.patch
```

语义版本号使用以下规则解决冲突（递增）：

* **主要**适用于向后兼容性的更改。
* **次要**适用于不破坏向后兼容性的新功能。
* **补丁**是针对错误修复和其他小的更改。

记住这个方案的简单记忆如下：

```
break.feature.fix
```

## Electron版本规则

由于对 Node 和 Chromium 的硬性依赖，Electron并不不遵循semver。因此，您应该始终引用特定版本的Electron。

版本号的使用请参照以下规则:

* 主要版本: 适用于 Electron API 的突破性变更 - 如果您从 `0.37.0` 升级到 `1.0.0`, 您将需要升级您的应用程序。
* 次要版本: 适用于 Chrome 主要版本 和 Node 次要版本升级; 或重大的 Electron 变动 - 如果您从 `0.37.0` 升级到 `1.0.0`, 您的应用程序仍然可以正常运行, 但你可能需要解决一些小幅的变动。
* 补丁版本: 适用于新功能的添加和 bug 修复 - 如果您从 `0.37.0` 升级到 `1.0.0`, 你的应用程序仍然像之前一样正常运行。

如果你使用 `electron` 或 `electron-prebuilt`，我们建议您设置固定的版本号（如 1.1.0 而不是^1.1.0），以确保Electron的所有升级都是由您（开发人员）进行的手动操作。

例如:

```bash
npm install electron --save-exact --save-dev
```

上文 `--save-exact` 指的是在 `package.json`中配置 `electron`版本号时不带 `^`或 `〜`前缀,比如 `1.6.2`而不是 `^ 1.6.2`,以确保除非开发者手动操作,否则不进行升级.

如果你使用 `〜`为前缀,如 `〜1.6.2`,则表示锁定主次版本但允许补丁的安装.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yuzhigang5460.gitbook.io/electron/tutorial/electron-versioning.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
