fix react-native @expo problem with create-react-native-app

初始化项目时的问题

  • $ create-react-native-app AwesomeProject
  • 通过上面的命令出现下面的错误:

    [1/4]   Resolving packages...
    warning react-native-scripts > xdl > auth0 > rest-facade > superagent-proxy > proxy-agent > socks-proxy-agent > socks@1.1.1
    0: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue i
    ntroduced in 2.1.0
    [2/4]   Fetching packages...
    info @expo/ngrok-bin-freebsd-x64@2.2.8: The platform "darwin" is incompatible with this module.
    info "@expo/[email protected]" is an optional dependency and failed compatibility check. Excluding it from instal
    lation.
    info @expo/ngrok-bin-linux-arm@2.2.8: The platform "darwin" is incompatible with this module.
    info "@expo/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installa
    tion.
    info @expo/ngrok-bin-linux-arm@2.2.8: The CPU architecture "x64" is incompatible with this module.
    info @expo/ngrok-bin-linux-ia32@2.2.8: The platform "darwin" is incompatible with this module.
    info "@expo/[email protected]" is an optional dependency and failed compatibility check. Excluding it from install
    ation.
    info @expo/ngrok-bin-linux-ia32@2.2.8: The CPU architecture "x64" is incompatible with this module.
    info @expo/ngrok-bin-freebsd-ia32@2.2.8: The platform "darwin" is incompatible with this module.
    info "@expo/[email protected]" is an optional dependency and failed compatibility check. Excluding it from insta
    llation.
    info @expo/ngrok-bin-freebsd-ia32@2.2.8: The CPU architecture "x64" is incompatible with this module.
    info @expo/ngrok-bin-linux-x64@2.2.8: The platform "darwin" is incompatible with this module.
    info "@expo/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
    info @expo/ngrok-bin-sunos-x64@2.2.8: The platform "darwin" is incompatible with this module.
    info "@expo/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
    info @expo/ngrok-bin-win32-x64@2.2.8-beta.1: The platform "darwin" is incompatible with this module.
    info "@expo/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
    info @expo/ngrok-bin-win32-ia32@2.2.8-beta.1: The platform "darwin" is incompatible with this module.
    info "@expo/[email protected]" is an optional dependency and failed compatibility check. Excluding it frominstallation.
    info @expo/ngrok-bin-win32-ia32@2.2.8-beta.1: The CPU architecture "x64" is incompatible with this module.
    info @expo/ngrok-bin-darwin-ia32@2.2.8: The CPU architecture "x64" is incompatible with this module.
    info "@expo/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
    info @expo/ngrok-bin-linux-arm64@2.2.8: The platform "darwin" is incompatible with this module.
    info "@expo/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
    info @expo/ngrok-bin-linux-arm64@2.2.8: The CPU architecture "x64" is incompatible with this module.
    

解决方案

方案1 :

https://github.com/react-community/create-react-native-app/blob/master/EJECTING.md
  • $ npm run eject

方案2:

  • 重新初始化项目使用 react-native init 来代替 create-react-native-app

参考链接:

  • https://github.com/react-community/create-react-native-app/issues/311
  • https://github.com/react-community/create-react-native-app/blob/master/EJECTING.md
  • https://stackoverflow.com/questions/44270504/react-native-ios-and-android-folders-not-present?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

第一开始遇到这个问题,走了很多弯路,后来通过观察项目中无 ios 和 android 文件夹,再次通过谷歌搜索,获得答案!

你可能感兴趣的:(React,React,Native,react-native)