React环境搭建

内容纲要

nvm安装


export NVM_SOURCE=https://gitlab.com/mirrorx/nvm.git
curl -o- https://gitlab.com/mirrorx/nvm/-/raw/master/install.sh | bash

或者


export NVM_SOURCE=https://gitlab.com/mirrorx/nvm.git
wget -qO- https://gitlab.com/mirrorx/nvm/-/raw/master/install.sh | bash

执行完之后会打印接下来执行的命

node.js安装


# 安装最新版node
nvm install node

nvm list

镜像源

设置国内镜像源:

npm:


npm config set registry https://mirrors.huaweicloud.com/repository/npm/

yarn安装

npm install --global yarn

yarn:

yarn config set registry https://mirrors.huaweicloud.com/repository/npm/

react工程生成


npx create-react-app ktools-web

# 支持typescript, 和上面二选一
npx create-react-app ktools-web --template typescript

# 支持typescript, 和上面三选一
yarn create react-app ktools-web --template typescript

启动react工程


yarn start

预览

file

发表评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注

滚动至顶部