question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

css-tree updated - breaks react-native-svg

See original GitHub issue

Bug

In the current react-native-svg - the css-tree dep was just updated from 1.0.0.alpha39 to 1.0.0, and they removed HexColor in place of Hash.js

Unexpected behavior

Error saying Unable to resolve module ‘./HexColor’ from node_modules/css-tree/lib/syntax/node/index.js

Environment info

Library version:

 "react-native-svg": "^12.1.0",

Steps To Reproduce

Do a clean RN app install w/ react-native-svg without specifying css-tree.

Describe what you expected to happen:

  1. No crashes in the simulator

Workaround

Current workaround / fix is to specify css-tree exact in package.json:

npm i css-tree@v1.0.0-alpha.39 --save-exact

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:18
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

28reactions
bluenexcommented, Nov 4, 2020

I have checked and found that react-native-svg doesn’t call HexColor at all.

https://github.com/react-native-svg/react-native-svg/blob/b2e2c355204ff4b10973d3afce1495f7e4167ff7/src/css.tsx#L17-L29

Thus I think the problem is about node modules caching, so I try closing the metro bundler and open the new one resetting the cache:

npx react-native start --reset-cache

This solves the error on build for me.

6reactions
cjpatoilocommented, Oct 29, 2020

Here I had the same error. Now worked fine after run $ npm i css-tree@v1.0.0-alpha.39 --save-exact.

Thank you @andrewrt 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

css-tree updated - breaks react-native-svg · Issue #1482
Bug In the current react-native-svg - the css-tree dep was just updated from 1.0.0.alpha39 to 1.0.0, and they removed HexColor in place of ......
Read more >
7 - Stack Overflow
I've been able to apply a temporary fix by upgrading css-tree dependency inside the react-native-svg , but this is a really wrong way...
Read more >
react-native-svg - npm
react -native-svg provides SVG support to React Native on iOS, Android, macOS, Windows, and a compatibility layer for the web.
Read more >
Css-tree NPM
CSSTree is a tool set for CSS: fast detailed parser (CSS → AST), walker (AST traversal), generator (AST → CSS) and lexer (validation...
Read more >
react-native-svg - npm Package Health Analysis - Snyk
Learn more about react-native-svg: package health score, popularity, security, maintenance, versions and more.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found