react-native - 找不到模块:无法解析 'node_modules\react-native\Libraries\Animated\src\components\AnimatedImage.js' 中的 '../../../Image/Image'
问题描述
当我开始运行 expo 时出现错误。我正在尝试启动一个正在进行的项目,但无法找出问题所在。
找不到模块:无法解析 'node_modules\react-native\Libraries\Animated\src\components\AnimatedImage.js' 中的 '../../../Image/Image'
包.json
"dependencies": {
"@react-native-community/async-storage": "^1.11.0",
"@react-native-community/blur": "^3.6.0",
"@react-native-community/datetimepicker": "2.6.1",
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/drawer": "^5.9.0",
"@react-navigation/native": "^5.7.3",
"@react-navigation/stack": "^5.9.0",
"@terrylinla/react-native-sketch-canvas": "^0.8.0",
"axios": "^0.19.2",
"expo": "~38.0.9",
"expo-splash-screen": "^0.5.0",
"expo-status-bar": "^1.0.0",
"expo-updates": "~0.2.10",
"formik": "^2.1.5",
"i18n-js": "^3.7.1",
"lodash.memoize": "^4.1.2",
"moment": "^2.27.0",
"native-base": "^2.13.13",
"react": "~16.11.0",
"react-dom": "~16.11.0",
"react-native": "~0.62.2",
"react-native-animated-nav-tab-bar": "^3.0.3",
"react-native-check-box": "^2.1.7",
"react-native-cn-richtext-editor": "^1.0.42",
"react-native-datepicker": "^1.7.2",
"react-native-dialog-component": "^0.2.17",
"react-native-dropdown-picker": "^3.1.11",
"react-native-dropdownalert": "^4.3.0",
"react-native-elements": "^2.2.1",
"react-native-face-pile": "^1.9.0",
"react-native-fast-image": "^8.3.2",
"react-native-gesture-handler": "^1.7.0",
"react-native-keyboard-aware-scroll-view": "^0.9.2",
"react-native-localize": "^1.4.1",
"react-native-masked-text": "^1.13.0",
"react-native-material-ui": "^1.30.1",
"react-native-modal": "^11.5.6",
"react-native-modal-datetime-picker": "^8.9.3",
"react-native-paper": "^4.0.1",
"react-native-reanimated": "^1.13.0",
"react-native-responsive-screen": "^1.4.1",
"react-native-safe-area-context": "^3.1.4",
"react-native-screens": "^2.10.1",
"react-native-snap-carousel": "^4.0.0-beta.5",
"react-native-unimodules": "~0.10.1",
"react-native-vector-icons": "^7.0.0",
"react-native-view-more-text": "^2.1.0",
"react-native-web": "~0.11.7",
"react-native-wechat": "^1.9.12",
"react-redux": "^7.2.1",
"redux": "^4.0.5",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
"yup": "^0.29.3"}
解决方案
看来您正在使用react-native-web
但最终依赖于react-native
文件node_modules\react-native\Libraries\Animated\src\components\AnimatedImage.js
。
您应该根据react-native-web 文档正确配置您的 webpack 配置:
// webpack.config.js
module.exports = {
// ...the rest of your config
resolve: {
alias: {
'react-native$': 'react-native-web'
}
}
}
推荐阅读
- javascript - 如何在html中的多个文本框中将多个文本框值从一个网页传输到另一个网页
- javascript - 此 JavaScript 代码应无限期运行,直到提供空字符串,但事实并非如此。为什么?
- java - 接口中的通用字段
- sql - 如何确保引用表也有数据
- anaconda - 是否可以选择复制一行并在 anaconda ide 中制作多个光标?
- macos - 如何在 Safari 中启用“显示开发菜单”
- php - Cybersource CodeIgniter 会话问题
- unity3d - WaitForEndOfFrame 在第一次运行时被调用两次
- flutter - 我怎样才能避免将一个变量结果更改为另一个变量结果
- python - 无论如何自定义Django的身份验证功能?