expo-cli全新安装错误

时间:2020-10-05 11:28:26

标签: react-native expo expo-cli

我按照文档中的说明运行了以下命令以开始使用:

$ yarn global add expo-cli
$ expo init myNewProject
$ cd myNewProject
$ expo start 

遇到以下错误

Error: Invalid sdkVersion. Valid options are 7.0.0, 8.0.0, 9.0.0, 10.0.0, 11.0.0, 12.0.0, 13.0.0, 14.0.0, 15.0.0, 16.0.0, 17.0.0, 18.0.0, 19.0.0, 20.0.0, 21.0.0, 22.0.0, 23.0.0, 24.0.0, 25.0.0, 26.0.0, 27.0.0, 28.0.0, 29.0.0, 30.0.0, 31.0.0, 32.0.0, 33.0.0, 34.0.0, 35.0.0, 36.0.0, 37.0.0, 38.0.0, 39.0.0
error: unknown option `--assetExts'

Metro Bundler process exited with code 1

比起我将"sdkVersion": "39.0.0",添加到app.json.expo,再次运行$ expo start,第二个错误仍然存​​在:

error: unknown option `--assetExts'

Metro Bundler process exited with code 1

运行$ EXPO_DEBUG=true expo start提供以下信息:

Metro Bundler process exited with code 1
Error: Metro Bundler process exited with code 1
    at ChildProcess.<anonymous> (/@expo/xdl@56.2.7/src/Project.ts:1804:16)
    at Object.onceWrapper (events.js:284:20)
    at ChildProcess.emit (events.js:196:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12)

我的app.json是:

{
  "name": "reactNativeExpo",
  "displayName": "React Native Expo",
  "expo": {
    "name": "reactNativeExpo",
    "slug": "expo-template-bare",
    "version": "1.0.0",
    "sdkVersion": "39.0.0",
    "assetBundlePatterns": ["**/*"]
  }
}

我的系统信息

$ yarn global list expo
yarn global v1.21.1
info "expo-cli@3.27.13" has binaries:
   - expo
   - expo-cli

$ npm -v
6.14.8

$ node -v
v12.0.0

同样,这是一个全新的安装,除了上面概述的步骤之外,我没有做任何其他事情。

感谢您的帮助:)

1 个答案:

答案 0 :(得分:0)

将节点升级到12.13.0就可以了。在expo-cli中打开了issue,以提供有关该文件的建议