react-native-svg: Can not resolve module
Hey guys, I recently ejected my app and updated to ExpoKit 35, and since then, I can’t launch the app on iOS anymore because there’s a problem with the react-native-svg module.
Commands :
expo install react-native-svgcd ios && pod installcd .. && expo start -cBuild and runon Xcode
Error below :
While trying to resolve module
react-native-svgfrom file/project/assets/illustrations/demo.svg, the package/project/node_modules/react-native-svg/package.jsonwas successfully found. However, this package itself specifies amainmodule field that could not be resolved (/project/node_modules/react-native-svg/src/index.ts. Indeed, none of these files exist:
/project/node_modules/react-native-svg/src/index.ts(.native||.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.svg|.native.svg|.svg|.ios.json|.native.json|.json)
/project/node_modules/react-native-svg/src/index.ts/index(.native||.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.svg|.native.svg|.svg|.ios.json|.native.json|.json)
Any of you guys had this issue before ? Any help appreciated 😃
I am currently using the following versions :
Expo : 35.0.0 ExpoKit : 35.0.1 React-native : https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz ( SDK 35 ) React-native-svg : 9.12.0 ( When installing, yarn says that version ~9.9.2 is required, but it gaves me the same error anyways ) CocoaPods : 1.8.3 Xcode : 11.1
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 30 (5 by maintainers)
I had the same issue, with same steps and same outcome. Figured out that in my app.json i had
"packagerOpts": { "config": "metro.config.js", "sourceExts": ["js","jsx","svg",] },insead of"packagerOpts": { "config": "metro.config.js", "sourceExts": [ "js","jsx","svg","ts","tsx"] },changing that fixed my issue@feliperoan Can you try v9.13.2? Or
yarn add css-tree css-selecthttps://github.com/react-native-community/react-native-svg/issues/1166#issuecomment-545573905npm i react-native-svgsolved for menpm i react-native-svgwork for me toI could not manage to resolve issue by @RobertMeGusta comments. Still having the same problem 😦 Do you have any other suggestions
I think problem is with react-native-svg >= 12.0.0. Yarn add react-native-svg@11.0.0 solved all issues
To reconfirm this can be resolved, when using
metro.config.jsby adding “ts” and “tsx” to thesourceExtsas follows:Hi I have the same error for a few hours I already deleted modules reinstall from scratch and I don’t have the solution
Loading dependency graph, done. error: bundling failed: Error: Unable to resolve modulecss-selectfromD:\Developement\dos\CloudMobile\SiigoApp\node_modules\react-native-svg\src\css.tsx: Modulecss-select` does not exist in the Haste module mapThis might be related to https://github.com/facebook/react-native/issues/4968 To resolve try the following:
watchman watch-del-all.node_modulesfolder:rm -rf node_modules && npm install.rm -rf /tmp/metro-bundler-cache-*ornpm start -- --reset-cache.rm -rf /tmp/haste-map-react-native-packager-*.`this from today, do you know how I can fix it?
yarn add react-native-svgsolved here@Asleepace this worked . . removing the Podfile.lock is necessary to get the updates from lastest css-tree modules you installed. In my case the error was “Unable to resolve module
./HexColor” it turns out they rename it from HexColor to Hash so in order to get the updates “Podfile.lock” file has to be removed before running pod install.I did already :
expo init testyarn add react-native-svg@9.13.2expo eject=> ExpoKitcd ios && pod installexpo start -cBuild and Runon XcodeAnd everything works fine 😕
I tried the commands, when i’m starting the packager with
react-native start --reset-cacheand launching the app withreact-native run-ios, the app is loading but ends up crashing after a black screen.When using
expo start -cinstead of thereact-native startcommand, I keep getting the module error