ice/website/docs/guide/basic/development.md

66 lines
1.7 KiB
Markdown
Raw Normal View History

文档 (#203) * feat: docs directory * docs: 调整结构 * chore: lock * feat: update docs * docs: update assets doc * 新增文档 for 介绍 and 环境变量 (#307) * docs: add about * docs: add docs for env * docs: update about * docs: config (#306) * docs: router (#304) * docs: router * feat: getconfig * docs: get data * docs: ssg * docs: ssr * docs: document * docs: page * docs: enable ssr * fix: title * Doc/rax compat (#303) * docs: add docs of rax-compat * docs: modify doc of rax compat * Docs: app entry (#301) * docs: app entry * docs: app entry * docs: mock (#245) * docs: mock * chore: typo * chore: title * docs: styles (#244) * docs: style * chore: acss title * Docs: contributing (#243) * docs: contributing * chore: typo * chore: update contributing docs * fix: typo * chore: add putteteer install * docs: quick start (#235) * docs: quick start * chore: update IDE * chore: update docs * docs: app directory (#236) * docs: directory * chore: document desc * docs: update website * docs: update about * docs: update docs * chore: update prism * chore: update docs * chore: update Co-authored-by: luhc228 <luhengchang228@126.com> Co-authored-by: ClarkXia <xiawenwu41@gmail.com> Co-authored-by: 逆葵 <xianyong.yxy@alibaba-inc.com> Co-authored-by: ZeroLing <zhuoling.lcl@alibaba-inc.com> Co-authored-by: ZeroLing <i@zeroling.com> Co-authored-by: 水澜 <shuilan.cj@taobao.com> Co-authored-by: 染陌同学 <answershuto@gmail.com> Co-authored-by: luhc228 <44047106+luhc228@users.noreply.github.com>
2022-07-01 16:47:25 +08:00
---
title: 开发环境
order: 1
---
## Node.js
开发前端应用前需要安装 [Node.js](https://nodejs.org),并确保 node 版本是 14.x 或以上。推荐使用 [nvm](https://github.com/nvm-sh/nvm) 或者 [fnm](https://github.com/Schniz/fnm) 来管理 node 版本,进行安装。下面以在 mac 下安装 nvm 为例:
```bash
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
# 安装 node 14 版本
$ nvm install 14
# 使用 node 14
$ nvm use 14
# 验证 node 是否安装成功
$ node -v
v14.19.3
```
在国内使用 npm 安装依赖可能会比较慢。建议使用国内镜像源进行加速:
```bash
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
# 验证 cnpm 安装是否成功
$ cnpm -v
```
### 包管理工具
安装 Node.js 后,默认会包含 npm。除此以外还有其他的包管理工具
- [pnpm](https://pnpm.io/)(推荐)
- [cnpm](https://www.npmjs.com/package/cnpm)(推荐)
- [yarn](https://yarnpkg.com/)
安装 pnpm 示例如下:
```bash
$ npm i pnpm -g --register=https://registry.npmmirror.com/
# 验证 pnpm 安装是否成功
$ pnpm -v
7.1.7
```
如果经常需要切换 npm 镜像源,推荐使用 [nrm](https://github.com/Pana/nrm) 进行管理:
```bash
$ npm install -g nrm
# 验证 nrm 是否安装成功
$ nrm --version
# 查看所有镜像源
$ nrm ls
# 推荐使用淘宝镜像源
nrm use taobao
```
### IDE
推荐使用 IDE 进行前端应用开发和调试,会有更好的调试体验。目前比较流行的 IDE 有:
- [Visual Studio Code](https://code.visualstudio.com/)(推荐)
- [WebStorm](https://www.jetbrains.com/webstorm/)(推荐)
- [Sublime Text](https://www.sublimetext.com/)
- [Atom](https://atom.io/)