簡體   English   中英

使用 create-expo-app 錯誤創建的 Expo 項目

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

使用create-expo-app的 Expo 項目在使用expo start命令運行時會導致捆綁錯誤。 我在 iOS(模擬器和物理設計)上使用 Expo Go。

空白項目和使用-t expo-template-blank-typescript標志和參數創建的 typescript 項目都會發生這種情況。

其中一個依賴項顯然找不到expo-constants模塊。

環境

  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

錯誤

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';

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"
  },

我有同樣的問題,沒有合適的解決方案,但這可以作為一種解決方法。 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