Skip to content

Hi was getting this weird error #229

@DyerMaker42

Description

@DyerMaker42

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-qrcode-svg@6.3.12 for the project I'm working on.

Basically crashed my app with error that looked like this


error: Error: Unable to resolve module react-native-svg/css from /Users/nicholas-mbp-fuego/bitbucket/settl-app/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 (/Users/nicholas-mbp-fuego/bitbucket/settl-app/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:162:15)
    at DependencyGraph.resolveDependency (/Users/nicholas-mbp-fuego/bitbucket/settl-app/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/node-haste/DependencyGraph.js:260:43)
    at Object.resolve (/Users/nicholas-mbp-fuego/bitbucket/settl-app/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/lib/transformHelpers.js:177:21)
    at Graph._resolveDependencies (/Users/nicholas-mbp-fuego/bitbucket/settl-app/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/DeltaBundler/Graph.js:432:35)
    at Graph._processModule (/Users/nicholas-mbp-fuego/bitbucket/settl-app/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/DeltaBundler/Graph.js:218:38)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Graph._addDependency (/Users/nicholas-mbp-fuego/bitbucket/settl-app/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/DeltaBundler/Graph.js:314:20)
    at async Promise.all (index 5)
    at async Graph._processModule (/Users/nicholas-mbp-fuego/bitbucket/settl-app/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/DeltaBundler/Graph.js:263:5)
    at async Graph._addDependency (/Users/nicholas-mbp-fuego/bitbucket/settl-app/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/DeltaBundler/Graph.js:314:20)
npm verbose cwd /Users/nicholas-mbp-fuego/bitbucket/settl-app

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-qrcode-svg/src/LogoSVG/index.native.js b/node_modules/react-native-qrcode-svg/src/LogoSVG/index.native.js
index 6c5b14a..392c763 100644
--- a/node_modules/react-native-qrcode-svg/src/LogoSVG/index.native.js
+++ b/node_modules/react-native-qrcode-svg/src/LogoSVG/index.native.js
@@ -1,5 +1,5 @@
 import React from "react";
-import { LocalSvg } from "react-native-svg/css";
+import { LocalSvg } from 'react-native-svg';
 import { SvgUri, SvgXml } from "react-native-svg";
 import { isString, isUrlString } from "../utils";
 

Basically changed one of the index.native.js files line 2 to import { LocalSvg } from 'react-native-svg/css'
This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions