Skip to main content

环境设置

要开始使用 Ionic 框架,唯一的要求是一个 Node & npm 环境。

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

当然,还需要一个代码编辑器。推荐使用 Visual Studio Code。Visual Studio Code 是由微软制作的免费、功能齐全的文本编辑器。

🌐 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

note

大量的 Ionic 开发需要熟悉命令行。如果你对命令行不熟悉,请参阅这篇博客文章以快速入门。

一般来说,我们建议使用内置终端。许多第三方终端可以很好地与 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 一起使用,但可能不受支持。
  • 对于 macOS,支持内置的 终端 应用。

Git Bash(来自 git-scm.com)不支持 TTY 交互,并且 不被 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 打包了 npm,这是 JavaScript 的包管理器。

🌐 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
note

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

git

🌐 Git

虽然不是必需的,但强烈推荐使用版本控制系统 Git

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

Git 通常会配合 Git 托管服务使用,例如 GitHub,在这种情况下需要进行额外的设置。请按照 Git 托管服务文档中的教程来设置 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 Desktop 是推荐的,并且与 GitHub 配合良好。

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