如何使用 Expo 清理(重置缓存)React Native.不知道是不是缓存问题 [英] How can I clean (reset cache) of React Native using Expo. Not sure if it is cache issue

查看:14
本文介绍了如何使用 Expo 清理(重置缓存)React Native.不知道是不是缓存问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用仅使用 react-navigation 和 base-64(base 64 编码/解码)作为依赖项的 create-react-native-app 构建一个简单的 React Native 应用程序.随着时间的推移,启动应用程序变得更慢,现在有时它在运行 NPM 启动后卡在正在启动打包程序..."上(等待大约 30 分钟).

I am building a simple React Native app with create-react-native-app using only react-navigation and base-64(base 64 encode/decode) as dependencies. Over time starting the app became slower and now sometimes it is getting stuck(waiting for about 30min) on "Starting packager..." after running NPM start.

我尝试使用npm start -- --reset-cache"启动它,但没有任何改变

I've tried starting it with "npm start -- --reset-cache" but nothing changed

一旦它启动并运行,我不会在 DevTools 或终端中收到任何错误或警告.应用程序的性能也没有问题

Once it is up and running I don't get any error or warning in DevTools or terminal. Also there are no issues with the performance of the app

如何让 NPM 像以前一样顺畅快速地启动?我可以采取任何一般步骤来解决此问题吗?

What can I do to make NPM start smooth and quickly as before? Are there any general steps I can take to troubleshoot this issue?

这是我的 package.json

Here is my package.json

{
  "name": "test",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "jest-expo": "~27.0.0",
    "react-devtools": "^3.2.3",
    "react-native-scripts": "1.14.0",
    "react-test-renderer": "16.3.1"
  },
  "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
  "scripts": {
    "start": "react-native-scripts start",
    "eject": "react-native-scripts eject",
    "android": "react-native-scripts android",
    "ios": "react-native-scripts ios",
    "test": "jest"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "base-64": "^0.1.0",
    "expo": "^27.0.1",
    "react": "16.3.1",
    "react-native": "~0.55.2",
    "react-navigation": "^2.11.2"
  }
}

推荐答案

expo r -c

根据 此论坛帖子 来自 Expo 开发人员,这是启动缓存清理的命令

According to this forum post from an Expo dev, that's the command to start it cache clean

他们已将其从 exp r -c 更改为 expo r -c

They have changed it from exp r -c to expo r -c

这篇关于如何使用 Expo 清理(重置缓存)React Native.不知道是不是缓存问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆