Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to resolve "react-native-svg/css" Unable to resolve "react-native-svg/css" from "node_modules/react-native-qrcode-svg/src/LogoSVG/index.native.js" #225

Open
cay-cospete opened this issue Dec 11, 2024 · 9 comments

Comments

@cay-cospete
Copy link

I am getting this error on

"react-native-qrcode-svg": "^6.3.12",

Unable to resolve "react-native-svg/css" from "node_modules/react-native-qrcode-svg/src/LogoSVG/index.native.js"

What is the issue here ?

@cay-cospete
Copy link
Author

@kkpo4553 How do i update this in the package itself though ? Why is this fix not a part of the package ?

@Kicu
Copy link
Contributor

Kicu commented Dec 12, 2024

hello @cay-cospete we would need to get more info about your setup to help you.

What version of react-native and react-native-svg are you using?
Can you provide extra details of when the error appears?
Can you provide a simple reproduction of this issue inside Example App that is part of this project?
Check: https://github.com/Expensify/react-native-qrcode-svg/blob/main/README.md#development-and-testing

@ThangNV1205
Copy link

@cay-cospete have you resolve it?

@alexsvt2
Copy link

alexsvt2 commented Dec 18, 2024

I'm facing the same error; the import is displayed with error in vscode.

image

image

@Kicu
Copy link
Contributor

Kicu commented Dec 18, 2024

hey @alexsvt2
The original poster said the error they were facing was:
Unable to resolve "react-native-svg/css" from "node_modules/react-native-qrcode-svg/src/LogoSVG/index.native.js"

although it is definitely similar, it is not the same as yours which looks as if in your project the library is not installed.

I can take a look if you answer my questions in this post: #225 (comment)
It is impossible for me to help without any extra details.

@alexsvt2
Copy link

hey @alexsvt2
The original poster said the error they were facing was:
Unable to resolve "react-native-svg/css" from "node_modules/react-native-qrcode-svg/src/LogoSVG/index.native.js"

although it is definitely similar, it is not the same as yours which looks as if in your project the library is not installed.

I can take a look if you answer my questions in this post: #225 (comment)
It is impossible for me to help without any extra details.

Yeah my mistake, I used npm i -S and worked, thank you

@shengl711
Copy link

I am facing the same issue although I already ran with npm i -S

The version the tool installed:
"react-native-qrcode-svg": "^6.3.12",
"react-native-svg": "^13.14.0",

This is the version of react-native I am using:
"react-native": "0.72.3",

error: Error: Unable to resolve module react-native-svg/css from C:\Users\eliza\StudioProjects\Torus\node_modules\react-native-qrcode-svg\src\LogoSVG\index.native.js: react-native-svg/css could not be found within the project or in these directories:
node_modules
1 | import React from "react";

2 | import { LocalSvg } from "react-native-svg/css";
| ^
3 | import { SvgUri, SvgXml } from "react-native-svg";
4 | import { isString, isUrlString } from "../utils";
5 |
at ModuleResolver.resolveDependency (C:\Users\eliza\StudioProjects\Torus\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:139:15)
at DependencyGraph.resolveDependency (C:\Users\eliza\StudioProjects\Torus\node_modules\metro\src\node-haste\DependencyGraph.js:277:43)
at Object.resolve (C:\Users\eliza\StudioProjects\Torus\node_modules\metro\src\lib\transformHelpers.js:169:21)
at Graph._resolveDependencies (C:\Users\eliza\StudioProjects\Torus\node_modules\metro\src\DeltaBundler\Graph.js:473:35)
at Graph._processModule (C:\Users\eliza\StudioProjects\Torus\node_modules\metro\src\DeltaBundler\Graph.js:261:38)
at async Graph._addDependency (C:\Users\eliza\StudioProjects\Torus\node_modules\metro\src\DeltaBundler\Graph.js:372:20)
at async Promise.all (index 5)
at async Graph._processModule (C:\Users\eliza\StudioProjects\Torus\node_modules\metro\src\DeltaBundler\Graph.js:322:5)
at async Graph._addDependency (C:\Users\eliza\StudioProjects\Torus\node_modules\metro\src\DeltaBundler\Graph.js:372:20)
at async Promise.all (index 1)

@DyerMaker42
Copy link

hey man I submitted a patch fix, but if you find node_modules/react-native-qrcode-svg/src/LogoSVG/index.native.js

and change line 2 from import { LocalSvg } from 'react-native-svg/css'; to import { LocalSvg } from 'react-native-svg';

worked for me hope helps

@shengl711
Copy link

But that means I need to manually hack node_modules file every single time developers rebuild since we are all actively making changes to the code and will need to run 'npm install'. Can you share which new version will contain this fix and ETA?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants
@Kicu @alexsvt2 @DyerMaker42 @ThangNV1205 @cay-cospete @shengl711 and others