zoukankan      html  css  js  c++  java
  • reactnative——环境搭建命令备份

     windows 10环境下:

    # 使用nrm工具切换淘宝源
    npx nrm use taobao

    # 如果之后需要切换回官方源可使用
    npx nrm use npm


    #安装yarn命令
    npm install -g yarn

    npm install -g react-native-cli

    #创建新项目
    npx react-native init AwesomeTSProject
    npx react-native init AwesomeTSProject --template react-native-template-typescript
    #编译运行
    cd AwesomeProject
    npm install

    连真机 adb devices 显示设备
    yarn android
    # 或者
    yarn react-native run-android

    #powershell无法使用yarn问题
    #yarn : 无法加载文件 C:\Users\yca\AppData\Roaming\npm\yarn.ps1,因为在此系统上禁止运行脚本
    #解决办法

    set-ExecutionPolicy RemoteSigned

    get-ExecutionPolicy

    重新安装nodejs
    1、下载zip https://nodejs.org/zh-cn/download/
    2、环境变量 path 中添加 D:\node\node-v16.13.1-win-x64
    3、修改全局路径
    npm root -g
    安装目录下创建两个文件夹,node_global 全局包存放,node_cache node缓存
    npm config set prefix D:\node\node-v16.13.1-win-x64\node_global
    npm config set cache D:\node\node-v16.13.1-win-x64\node_cache
    4、环境变量 path 中添加 D:\node\node-v16.13.1-win-x64\node_global
    5、添加系统变量
    NODE_PATH D:\node\node-v16.13.1-win-x64\node_global\node_modules

    运行旧项目时遇到的问题:

    1、react-native run-android 运行旧项目时 maybe you meant react-native-cli?

    或者打开package.json文件,在scripts节点中添加

    "android": "node node_modules/react-native/local-cli/cli.js run-android"

  • 相关阅读:
    POJ 2923 Relocation (状态压缩,01背包)
    HDU 2126 Buy the souvenirs (01背包,输出方案数)
    hdu 2639 Bone Collector II (01背包,求第k优解)
    UVA 562 Dividing coins (01背包)
    POJ 3437 Tree Grafting
    Light OJ 1095 Arrange the Numbers(容斥)
    BZOJ 1560 火星藏宝图(DP)
    POJ 3675 Telescope
    POJ 2986 A Triangle and a Circle
    BZOJ 1040 骑士
  • 原文地址:https://www.cnblogs.com/xingchong/p/15716528.html
Copyright © 2011-2022 走看看