AUR0722
Invalid platform object provided to the compilation, no DOM API found.
Error message
Invalid platform object provided to the compilation, no DOM API found.
Parameters
None
Error explanation
This error occurs during the template compilation setup when the compiler cannot access a valid Document Object Model (DOM) API through the provided platform object. The template compiler requires access to standard DOM features (like document, createElement, etc.) to parse and process HTML templates. This error indicates that the environment where the compilation is happening is missing these essential DOM APIs or that the platform abstraction used by Aurelia was not correctly initialized with them.
Common causes
Running the template compiler in a non-browser environment (e.g., Node.js) without providing a DOM implementation (like
jsdom).Incorrectly configuring or initializing the Aurelia
IPlatformservice in a custom setup.An issue with the environment's global
documentobject if running in a browser-like context.
How to fix
Browser Environment: Ensure you are running the application in a standard browser environment where
window.documentis available.Node.js/SSR Environment: If compiling templates outside a browser, ensure a DOM implementation (like
jsdom) is correctly configured and provided to Aurelia's platform abstraction before compilation occurs. Refer to Aurelia's Server-Side Rendering (SSR) documentation for guidance.Custom Platform: If using a custom
IPlatformimplementation, verify that it correctly provides access to a functional DOM API, including adocumentobject with standard properties and methods.
Debugging tips
Verify the execution environment (browser vs. non-browser).
If in Node.js, check your DOM simulation setup (e.g.,
jsdominitialization).Inspect the
IPlatformservice registered in the DI container to ensure it holds a valid DOM reference.
Last updated
Was this helpful?