css-tree updated - breaks react-native-svg
See original GitHub issueBug
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:
- 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:
- Created 3 years ago
- Reactions:18
- Comments:9 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have checked and found that
react-native-svg
doesn’t callHexColor
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:
This solves the error on build for me.
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 🙏