2. 创建npx react - 踩坑

创建一个项目非常的简单,直接去看官网就可以了。链接:创建一个新的 React APP - React 中文网

我参考的教程上需要使用react + typescript,所以直接在创建的时候,命令行加上了typescript的template。

命令行:

npx create-react-app client-app --use-npm --template typescript

安装完成后可以看到:

Success! Created client-app at /Users/miemie/Desktop/Reactivies/client-app
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd client-app
  npm start

几个菜坑点:

菜坑1: 注意node js 和 npm的版本

不需要最新,但是至少要支持: Node >= 6 和 npm >= 5.2

菜坑2: 使用的mac os之前没有更新过tar,所以在第一次的时候会报错:

npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.

只需要更新一下:

npm install -g tar

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值