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.

With Expo web: Failed to execute 'createElement' on 'Document'

See original GitHub issue

Hello,

I am using Expo 39’s managed workflow.

I followed the installation instruction, created the metro.config.js file, and copy-pasted the content from the instructions. I also added the packagerOpts field to my app.json.

For testing purpose, I renamed my SVG file to logo.svg and used the following code in my app:

import Logo from "../../assets/images/avatars/logo.svg"

function TestComp() {
	const size = 120;
	return <Logo width={size} height={size}/>
}

Unfortunately, I am now getting the error: InvalidCharacterError: Failed to execute 'createElement' on 'Document': The tag name provided ('/static/media/logo.6a5b59b1.svg') is not a valid name.

Any idea about what is causing the error?

I don’t know if it is related, but I do have a babel.config.js file in my root folder.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
DrimZcommented, Apr 29, 2021

encountered the same issue,

i solve this by adding babel-plugin-inline-react-svg as dev dependencies

then add this to your babel.config.js

{ "plugins": [ "inline-react-svg" ] }

thanks to this guy https://github.com/boopathi/react-svg-loader/issues/197#issuecomment-377562447

7reactions
lucassouza16commented, Jan 9, 2022

@DrimZ usou essa solução, embora faça a web expo funcionar, ela quebra o simulador ios e android.

O erro: Invariant Violation: View config getter callback for component caminho must be a function (received 'undefined'). Make sure to start component names with a capital letter.

I created a temporary solution focused on the problem related to Expo, if you want you can take a look:

https://github.com/lucassouza16/react-native-svg-transformer-fix-expo

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to execute 'createElement' on 'Document': The tag ...
I got this error. It happened that the name of the js folder had spaces at the end of it.
Read more >
@flyskywhy/react-native-gcanvas - npm
A C++ native canvas 2D/WebGL component based on gpu opengl glsl shader GCanvas. Latest version: 5.0.2, last published: 2 hours ago.
Read more >
Failed to execute 'createElement' on 'Document' error message
Hello, while logged into my website, hovering over the “G Site Kit” link in the black WordPress admin bar at the top of...
Read more >
Handle platform differences - Expo Documentation
Android, iOS, and the web have different capabilities. ... Stop the development server and run the following command to install the library: Terminal....
Read more >
How to add React Native Web to an existing ... - Aryan Goharzad
If you've initialized your project with Expo, it already comes with React Native for Web pre-configured. Otherwise, you can find instructions on ...
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