Windows下React的安装与使用

1. npm安装

下载node.js: nodejs.org/en/download… 命令行下输入: npm -v 验证是否安装成功。

2. cnpm安装

安装命令: npm install -g cnpm --registry=https://registry.npm.taobao.org 命令行下输入: cnpm -v 验证是否安装成功。

3. 创建React项目并运行————如果已有项目,可略过,先npm install再npm start

 
perl
复制代码
npx create-react-app my-app
cd my-app
npm start

以上方法为官网方法,可能太慢,可使用下面方法

 
arduino
复制代码
npm config set registry https://registry.npm.taobao.org
npx create-react-app todolist
cd todolist
npm start

4. 查看项目

浏览器输入地址:localhost:3000 运行结果

 


 
posted @ 2023-06-12 13:59  Oops!#  阅读(123)  评论(0编辑  收藏  举报