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

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

问题描述

我正在使用create-react-native-app构建一个简单的React Native应用程序,仅使用react-navigation和base-64(base 64编码/解码)作为依赖项.随着时间的流逝,启动该应用程序的速度变慢,现在有时在运行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

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

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