React Native 基于Expo开发踩坑日记

960 阅读1分钟

使用expo创建项目时报错

expo init my-project

WARNING: The legacy expo-cli does not support Node +17. Migrate to the new local Expo CLI: https://blog.expo.dev/the-new-expo-cli-f4250d8e3421.

The global expo-cli package has been deprecated.

The new Expo CLI is now bundled in your project in the expo package.
Learn more: https://blog.expo.dev/the-new-expo-cli-f4250d8e3421.

To use the local CLI instead (recommended in SDK 46 and higher), run: 
› npx expo <command> 

image.png

问题一

  • 刚开始以为是node版本的问题,切换了16.20.0依然报错 image.png

解决方法:

  • 查了下github发现expo脚手架迁移,新的脚手架安装命令:
  • npm i -g eas-cli
  • 安装完成后执行项目创建命令:npx expo init client-react-native
  • 提示需要安装 expo@51.0.9
  • 安装后再执行:npx expo init client-react-native

image.png

参考: juejin.cn/post/710280…

blog.expo.dev/expo-sdk-48…