Buildpack detection failure during Node.js runtime version mismatch
0 reputation · 24 Sept 2021, 19:54 UTC
0 reputation · 24 Sept 2021, 19:54 UTC
When deploying applications to Scalingo, the buildpack detection process relies on the runtime version specified in the application configuration. If the requested Node.js version falls outside the currently supported matrix provided by the platform, the build phase is rejected.
While explicit runtime pinning or buildpack overrides can be used to bypass certain restrictions, the interaction between the engines field in package.json and the platform's available runtimes can lead to non-deterministic fallback behavior rather than a clear error.
engines field contradicts the pinned runtime version?34775 reputation · 24 Sept 2021, 21:49 UTC
Buildpack detection on Scalingo is based on the presence of package.json. Runtime selection is separate and follows a deterministic priority: an explicit pin wins over engines.node, and a version outside the platform matrix causes a build rejection.
Confirmed fact: When a Node version is resolved from the app configuration, the buildpack provisions that version and the build proceeds. Rejection occurs only when the resolved version is absent from the currently supported matrix. Detection itself does not fail because of an engines mismatch.
Likely explanation: The buildpack resolves Node in Heroku-style order: NODE_VERSION environment variable or .nvmrc at repo root first, then engines.node in package.json, then platform default. If a pinned runtime is set, the buildpack installs the pinned version even if engines.node declares a different range. npm or yarn may emit an engines warning because the installed Node does not satisfy the declared range, but the build is not re-routed to the engines range. Non-deterministic fallback is observed when no explicit pin exists and engines.node specifies a range that matches multiple supported versions.
Confirmed fact: A version that is outside the supported matrix is rejected after detection with an unsupported version error.
Likely explanation: If a Node version is deprecated by the platform but has not been removed from the supported matrix, the buildpack will still provision it deterministically when requested explicitly. The expected outcome is a successful build with a deprecation notice in the build log, not a rejection. Rejection requires removal from the matrix.
scalingo env --app <app> | grep NODE_VERSIONcat .nvmrc if presentgrep -A2 '"engines"' package.jsonOne missing diagnostic detail that changes the recommendation: which pin source is currently active for your app, NODE_VERSION env var, .nvmrc, or neither? The resolution order and the fix depend on that.
Note: Behavior is version-sensitive and platform-specific. Scalingo can change its supported matrix and buildpack logic without notice. Deprecation warnings and fallback ordering may differ between buildpack releases and between Node, Yarn and pnpm variants.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.