node_modules/expo/AppEntry.js:Transformer.transform 不是函数 [英] node_modules/expo/AppEntry.js: Transformer.transform is not a function

查看:28
本文介绍了node_modules/expo/AppEntry.js:Transformer.transform 不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I've been looking for a solution to this problem for a couple of days now and I think it has something to do with my upgrade to the latest version of expo. I've tried downgrading the SDK and expo version, deleting my node_modules and package-lock and reinstalling. I've added in SourceExts to my app.json.

Any help would be appreciated. The app works in the web browser but won't build for iOs or android simulators.

app.json

{
  "expo": {
    "name": "GotThis",
    "slug": "GotThis",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "supportsTablet": true
    },
    "web": {
      "favicon": "./assets/favicon.png"
    },
    "packagerOpts": {
      "sourceExts": ["js", "json", "ts", "tsx", "jsx"]
    }
  }
}

package.json

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "test": "jest",
    "eject": "expo eject"
  },
  "dependencies": {
    "expo": "~38.0.8",
    "expo-status-bar": "^1.0.2",
    "react": "~16.11.0",
    "react-dom": "~16.11.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz",
    "react-native-elements": "^2.0.4",
    "react-native-paper": "^4.0.1",
    "react-native-web": "~0.11.7"
  },
  "devDependencies": {
    "@babel/core": "^7.10.5",
    "babel-preset-expo": "^8.1.0",
    "jest-expo": "^38.0.2",
    "metro": "^0.60.0",
    "metro-react-native-babel-preset": "^0.59.0",
    "react-test-renderer": "^16.13.1"
  },
  "jest": {
    "preset": "jest-expo",
    "transformIgnorePatterns": [
      "node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|@sentry/.*)"
    ]
  },
  "private": true
}

node_modules/expo/AppEntry.js

import registerRootComponent from 'expo/build/launch/registerRootComponent';

import App from '../../App';

registerRootComponent(App);

Error in the android emulator android error

解决方案

npm ls metro-config

In my case, I changed my version of the metro from 0.65.0 to 0.56.4 and fixed the issue. ubuntu here.

这篇关于node_modules/expo/AppEntry.js:Transformer.transform 不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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