Skip to main content

环境设置

要开始使用 Ionic Framework,唯一的要求是 Node 与 npm 环境。

¥To get started with Ionic Framework, the only requirement is a Node & npm environment.

当然,还需要一个代码编辑器。推荐使用 Visual Studio Code。Visual Studio Code 是 Microsoft 制作的一款免费、含适配器的文本编辑器。

¥Of course, a code editor is also required. Visual Studio Code is recommended. Visual Studio Code is a free, batteries-included text editor made by Microsoft.

终端

¥Terminal

注意

Ionic 的大部分开发都需要熟悉命令行。如果你不熟悉命令行,请参阅 这篇博文 以获取快速介绍。

¥Much of Ionic development requires familiarity with the command line. If you're new to the command line, see this Blog Post for a quick introduction.

一般来说,我们建议使用内置终端。许多第三方终端与 Ionic 配合良好,但可能不受支持。

¥In general, we recommend using the built-in terminals. Many third-party terminals work well with Ionic, but may not be supported.

  • 对于 Windows,支持命令提示符和 PowerShell。已知 WSL 可与 Ionic 配合使用,但可能不受支持。

    ¥For Windows, Command Prompt and PowerShell are supported. WSL is known to work with Ionic, but may not be supported.

  • 对于 macOS,支持内置终端应用。

    ¥For macOS, the built-in Terminal app is supported.

Git Bash(从 git-scm.com 开始)不支持 TTY 交互,并且不受 Ionic 支持。

¥Git Bash (from git-scm.com) does not support TTY interactivity and is not supported by Ionic.

Node 与 npm

¥Node & npm

现代 JavaScript 项目的几乎所有工具都基于 Node.js下载页面 已经为所有平台预先构建了安装包。我们建议选择 LTS 版本以确保最佳兼容性。

¥Almost all tooling for modern JavaScript projects is based in Node.js. The download page has prebuilt installation packages for all platforms. We recommend selecting the LTS version to ensure best compatibility.

Node 与 JavaScript 的包管理器 npm 打包在一起。

¥Node is bundled with npm, the package manager for JavaScript.

要验证安装,请打开一个新的终端窗口并运行:

¥To verify the installation, open a new terminal window and run:

$ node --version
$ npm --version
注意

使用 npm 安装全局包时,权限错误在 macOS 上很常见。如果你收到 EACCES 错误,请参阅 解决权限错误

¥Permission errors are common on macOS when installing global packages with npm. If you get an EACCES error, see Resolving Permission Errors.

git

尽管不是必需的,但强烈建议使用版本控制系统 git

¥Although not required, the version control system Git is highly recommended.

Git 通常伴随着 Git Host,例如 GitHub,在这种情况下需要额外的设置。按照 Git Host 文档中的教程来设置 Git:

¥Git is often accompanied by a Git Host, such as GitHub, in which case additional setup is required. Follow the tutorial from the Git Host's documentation to set up Git:

否则,请遵循 官方安装说明。命令行实用程序可以从 下载页面 下载。

¥Otherwise, follow the official installation instructions. The command-line utility can be downloaded from the download page.

要验证安装,请打开一个新的终端窗口并运行:

¥To verify the installation, open a new terminal window and run:

git --version

Git GUI

Git 是一个命令行实用程序,但有许多 图形用户界面客户端 可用。推荐使用 GitHub 桌面版,与 GitHub 配合良好。

¥Git is a command-line utility, but there are many GUI clients available. GitHub Desktop is recommended, and works well with GitHub.