deepin react-native 开发环境搭建

来源:互联网 发布:剑三叽太捏脸数据 编辑:程序博客网 时间:2024/06/11 17:59

      • Nodejs安装
      • Yarn安装
      • create-react-native-app
      • expo预览APP
      • 搭建过程二三事

Node.js安装

  • 下载安装包https://nodejs.org/zh-cn/
  • 安装
# 解压tar xvf node-v8.9.3-linux-x64.tar.xz# 复制到你喜欢的目录 ~/software/mv node-v8.9.3-linux-x64 ~/software/# 添加到全局ln -s /home/ff/software/node-v8.9.3-linux-x64/bin/node /usr/local/bin/nodeln -s /home/ff/software/node-v8.9.3-linux-x64/bin/npm /usr/local/bin/npm
  • 验证
# 任意目录node -v && npm -v# 输出v8.9.35.5.1

Yarn安装

  • 参照官网即可
  • 使用Yan代替npm可以加快依赖包的下载速度
  • Yarn npm设置淘宝镜像
yarn config set registry https://registry.npm.taobao.orgnpm config set registry https://registry.npm.taobao.org

create-react-native-app

# 安装yarn global add create-react-native-app# 创建项目create-react-native-app my-project# 进入目录cd my-project# 启动服务yarn start

expo预览APP

  • expogoogle play上,因此通过APKPure来安装
  • APKPure上安装expo
  • expo扫码预览APP

搭建过程二三事

  • yarn start启动提示
20:24:57: Unable to start server  See https://git.io/v5vcn for more information, either install watchman or run the following snippet:    sudo sysctl -w fs.inotify.max_user_instances=1024    sudo sysctl -w fs.inotify.max_user_watches=12288error Command failed with exit code 1.info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
  • /etc/sysctl.conf最后面添加下面两行,解决上面的提示
# gedit /etc/sysctl.conffs.inotify.max_user_instances=1024fs.inotify.max_user_watches=12288
  • su用户第一次密码设置
# 按提示输入密码即可sudu passwd
原创粉丝点击