ENOENT error when resolving template paths in production
0 reputation · 16 May 2025, 09:28 UTC
In Kraken.js, the templates configuration accepts a path to the directory containing view templates. When a relative path is provided, it resolves correctly in the local development environment because the working directory matches the project root. However, in production the working directory may differ, causing the same relative path to resolve to a non-existent location and throwing an ENOENT error. The documentation states that the path must be absolute, but does not specify whether the framework normalizes relative paths based on the application root or the current working directory. This discrepancy leads to a configuration that works locally but fails in production.
What is the intended resolution strategy for the templates path in Kraken.js? Should the configuration always use an absolute path, or does the framework provide a way to reference the application root? How can a developer ensure consistent template loading across environments without hardcoding absolute paths?