简体   繁体   English

使用 create-expo-app 错误创建的 Expo 项目

[英]Expo project created with create-expo-app errors

An Expo project created with create-expo-app causes a bundle error when ran with expo start command.使用create-expo-app的 Expo 项目在使用expo start命令运行时会导致捆绑错误。 I'm using Expo Go on iOS (both simulator and physical devise).我在 iOS(模拟器和物理设计)上使用 Expo Go。

This happens with both a blank project and a typescript project that is created with -t expo-template-blank-typescript flag and argument.空白项目和使用-t expo-template-blank-typescript标志和参数创建的 typescript 项目都会发生这种情况。

One of the dependencies apparently cannot find expo-constants module.其中一个依赖项显然找不到expo-constants模块。

Environment环境

  expo-env-info 1.0.5 environment info:
    System:
      OS: macOS 12.2.1
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node
      Yarn: 1.22.18 - ~/.nvm/versions/node/v14.17.0/bin/yarn
      npm: 7.22.0 - ~/.nvm/versions/node/v14.17.0/bin/npm
    Managers:
      CocoaPods: 1.11.3 - /usr/local/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    IDEs:
      Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
    npmPackages:
      expo: ~45.0.0 => 45.0.8 
      react: 17.0.2 => 17.0.2 
      react-dom: 17.0.2 => 17.0.2 
      react-native: 0.68.2 => 0.68.2 
      react-native-web: 0.17.7 => 0.17.7 
    npmGlobalPackages:
      eas-cli: 0.56.0
      expo-cli: 6.0.1
    Expo Workflow: managed

Error错误

iOS Bundling failed 3713ms
Unable to resolve module expo-constants from path/to/my-app/node_modules/expo-asset/build/PlatformUtils.js: expo-constants could not be found within the project or in these directories:
  node_modules
  1 | import computeMd5 from 'blueimp-md5';
> 2 | import Constants from 'expo-constants';
    |                        ^
  3 | import * as FileSystem from 'expo-file-system';
  4 | import { NativeModulesProxy } from 'expo-modules-core';
  5 | import { getManifestBaseUrl } from './AssetUris';

Dependencies installed by npx create-expo-app npx create-expo-app安装的依赖项

"dependencies": {
    "expo": "~45.0.0",
    "expo-status-bar": "~1.3.0",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-native": "0.68.2",
    "react-native-web": "0.17.7"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9"
  },

I have the same problem, don't have a proper solution but this works as a workaround.我有同样的问题,没有合适的解决方案,但这可以作为一种解决方法。 Run it before expo start .expo start之前运行它。

expo install expo-constants expo-file-system expo-modules-core

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM