图片路径react-native:无法解析模块
我试图在应用程序中添加静态图像作为图标时出现此错误。我的所有资产都位于根目录中的assets
文件夹中。我已将我的应用程序命名为jobsicle
以使用绝对路径而不是../../assets/...
。当我运行我的应用程序我得到这个错误:图片路径react-native:无法解析模块
The development server returned response error code: 500
URL: http://192.168.56.1:19001/node_modules/expo/AppEntry.bundle?platform=android&dev=true&strict=false&minify=false&hot=false&assetPlugin=expo/tools/hashAssetFiles
体:{ “从”:“C:\用户\ Shahzaib 拉希姆\文件\工作\ jobsicle \屏幕\用人\ EmployerHomeScreen.js “‘为’:‘jobsicle/assets/icons/bottomNav/[email protected]’,‘消息’:”无法 解析模块
jobsicle/assets/icons/bottomNav/[email protected]
从C:\\Users\\Shahzaib Rahim\\Documents\\work\\jobsicle\\screens\\employer\\EmployerHomeScreen.js
: 模块不会在模块地图\ n \存在nThis可能与 https://github.com/facebook/react-native/issues/4968https://github.com/facebook/react-native/issues/4968 \ n要解决尝试 以下内容:\ n 1.清除守望员手表:watchman watch-del-all
。\ n 2.德LETE的node_modules
文件夹:rm -rf node_modules && npm install
\ n 3.复位打包器缓存:rm -fr $TMPDIR/react-*
或npm start -- --reset-cache
“” 名称 “:” UnableToResolveError”, “类型”: “UnableToResolveError”, “错误”:[{}]}
为什么我遇到这个错误?
通过重命名图标而无需特殊字符(如@
和_
)解决了此问题。显然,具有特殊字符的文件名会在节点运行时触发错误。
您是否尝试再次运行npm start? – SNT