目录

What should I do if the error message "Failed to execute 'createElement' on 'Document'" is displayed?

Symptom

The error message Uncaught InvalidCharacterError: Failed to execute 'createElement' on 'Document': The tag name provided ('components/custom/index') is not a valid name. is displayed when createElement is run.

Possible causes

The is attribute does not support the component path. The value must comply with the HTML Standard: starting with a letter and containing hyphens (-), dots (.), digits, underscores (_), and lowercase letters.

Solution

Use the explicit component name and ensure the component is registered. For mini-program conversion scenarios, the skeleton component supports direct tag usage, so the is attribute can be omitted.