我已经开发了一个运行于IOS和Android的简单工作流应用程序。现在,我想在网上运行这个应用程序。
当我尝试使用“纱运行网络”运行时,我会得到以“模块未找到:无法解决”开头的错误
Module not found: Can't resolve '../../assets/Icon/Home/switchViewIcon.png'
58 | >
59 | <Image
> 60 | source={require('../../assets/Icon/Home/switchViewIcon.png')}
| ^
61 | style={{ height: 25, width: 25, padding: 10 }}
62 | hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}
63 | />
./node_modules/@invertase/react-native-apple-authentication/lib/index.js:24
Module not found: Can't resolve './AppleButton'
22 |
23 |
> 24 | export { default as AppleButton } from './AppleButton';
25 |
26 | /**
27 | * iOS
./resourceConfig.js:15:11
Module not found: Can't resolve './assets/Icon/Home/switchViewIcon.png'
这就是我的package.json的样子
{
"main": "index.js",
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"web": "expo start --web",
"start": "react-native start",
"build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'"
},
"dependencies": {
"@babel/preset-typescript": "^7.16.7",
"@expo-google-fonts/mulish": "^0.2.2",
"@invertase/react-native-apple-authentication": "^2.2.1",
"@react-native-async-storage/async-storage": "^1.17.3",
"@react-native-clipboard/clipboard": "^1.10.0",
"@react-native-community/push-notification-ios": "^1.10.1",
"@react-native-firebase/analytics": "^14.8.0",
"@react-native-firebase/app": "14.11.1",
"@react-native-firebase/auth": "^14.7.0",
"@react-native-firebase/crashlytics": "^14.11.1",
"@react-native-firebase/firestore": "^14.7.0",
"@react-native-firebase/functions": "^14.8.0",
"@react-native-firebase/messaging": "^14.8.0",
"@react-native-firebase/storage": "^14.8.0",
"@react-native-google-signin/google-signin": "^7.2.2",
"@react-navigation/bottom-tabs": "^5.11.11",
"@react-navigation/native": "^6.0.6",
"@react-navigation/stack": "^5.14.5",
"algoliasearch": "^4.10.4",
"eas-cli": "^0.49.0",
"expo": "^44.0.4",
"expo-device": "^4.1.1",
"expo-image-manipulator": "~10.2.0",
"expo-image-picker": "~12.0.1",
"expo-linear-gradient": "~11.0.0",
"expo-location": "~14.0.1",
"expo-splash-screen": "^0.14.2",
"expo-status-bar": "^1.2.0",
"expo-updates": "~0.11.3",
"firebase": "8.2.3",
"geofire-common": "^5.2.0",
"lodash.clonedeep": "^4.5.0",
"lottie-react-native": "5.0.1",
"moment": "^2.29.3",
"prop-types": "^15.7.2",
"react": "17.0.1",
"react-art": "^18.2.0",
"react-dom": "^18.2.0",
"react-instantsearch-native": "^6.12.1",
"react-native": "0.64.3",
"react-native-awesome-alerts": "^1.5.2",
"react-native-date-picker": "^4.2.2",
"react-native-dropdown-picker": "https://github.com/ppoom/react-native-dropdown-picker.git",
"react-native-elements": "^3.4.2",
"react-native-gesture-handler": "~2.1.0",
"react-native-get-random-values": "^1.7.2",
"react-native-gifted-chat": "^1.0.0",
"react-native-google-places-autocomplete": "^2.4.1",
"react-native-image-crop-picker": "^0.37.3",
"react-native-image-slider-box": "^1.1.23",
"react-native-inset-shadow": "^1.0.3",
"react-native-maps": "0.29.4",
"react-native-modal": "^13.0.0",
"react-native-orientation-loading-overlay": "^0.1.6",
"react-native-pager-view": "^5.4.9",
"react-native-push-notification": "^8.1.1",
"react-native-read-more-text": "^1.1.2",
"react-native-reanimated": "^2.3.1",
"react-native-safe-area-context": "^4.3.1",
"react-native-screens": "^3.10.1",
"react-native-snap-carousel": "^3.9.1",
"react-native-swipe-gestures": "^1.0.5",
"react-native-switch-toggle": "^2.2.1",
"react-native-tab-view": "2",
"react-native-vector-icons": "^8.1.0",
"react-native-web": "^0.18.6",
"react-navigation": "^4.4.4",
"react-router-dom": "^6.3.0",
"react-router-native": "^6.3.0",
"uuid": "^8.3.2"
},
"devDependencies": {
"@babel/core": "~7.9.0",
"eslint": "^8.3.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "^7.27.1",
"prettier": "2.5.0"
},
"postinstall": "npx patch-package",
"private": true
}
这就是我的index.js的样子
import { registerRootComponent } from 'expo';
import App from './App';
registerRootComponent(App);
我需要配置额外的东西吗?
发布于 2022-07-14 02:51:26
这是因为
source={require('../../assets/Icon/Home/switchViewIcon.png')}
在
<Image
> 60 | source={require('../../assets/Icon/Home/switchViewIcon.png')}
| ^
61 | style={{ height: 25, width: 25, padding: 10 }}
62 | hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}
63 | />
找不到您可以确保源或路径正确的switchViewIcon.png
https://stackoverflow.com/questions/72974617
复制相似问题