Failure when running "Verify run directory", incorrect node version

In recent builds, the Verify run directory step of the build process started throwing an error:

6:07:07 PM: Verify run directory
6:07:07 PM: internal/modules/cjs/loader.js:905
6:07:07 PM:   throw err;
6:07:07 PM:   ^
6:07:07 PM: Error: Cannot find module '/opt/build/repo/node_modules/which/bin/which'
6:07:07 PM:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
6:07:07 PM:     at Function.Module._load (internal/modules/cjs/loader.js:746:27)
6:07:07 PM:     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
6:07:07 PM:     at internal/main/run_main_module.js:17:47 {
6:07:07 PM:   code: 'MODULE_NOT_FOUND',
6:07:07 PM:   requireStack: []
6:07:07 PM: }
6:07:09 PM: 

This does not cause the build to fail, but it seems to affect the node version used in the subsequent steps.

Although in previous logs it outputs:

6:07:04 PM: v14.18.2 is already installed.
6:07:04 PM: Now using node v14.18.2 (npm v6.14.15)

after the Verify run directory it seems to incorrectly default to v12.22.8:

|  WARN  Unsupported engine: wanted: {"node":"^14.18 || >= 16.0.0"} (current: {"node":"v12.22.8","pnpm":"6.24.4"})

No changes to deploy configuration since the last successful build of the site.

Hi @ElMassimo,

Is the behaviour same when running the build after clearing cache?

Hi @hrishikesh! The behavior is the same after clearing the cache, or changing the NODE_VERSION.

Hi, @ElMassimo. I only see one build without the cache which is this one here:

However, that wasn’t the same. The build was stopped long before the place the error occurs because of this log line that I linked to above. I’ve quoted that line below:

10:25:33 AM: Detected ignore command in Netlify configuration file. Proceeding with the specified command: 'exit 0'

Note, an exit code of zero for the build ignore is the exit code to cancel a build. To force a build to happen use a build ignore command of false. The command false (it is a command not a value) is a program that always returns an exit code of 1 and that will force the build to continue, not to stop.

Would you please try building again with that build ignore command and while also clearing the build cache?

Clearing the cache seems to have fixed the problem.

Since I was using build hooks to selectively deploy the site, I had to temporarily remove the build ignore and use the UI to clear the cache and redeploy (it seems that triggering a build with a cleared cache doesn’t affect the cache in subsequent builds, at least not if that build fails).

Thanks!

Hi, @ElMassimo. You are correct about failing builds not saving the cache. Only the caches of a successful deploy will be saved.

I’m glad to hear that deploys are now working again after a clearing the cache and a successful deploy. Please reply here anytime if there is more information to share or any other questions.

1 Like

Thanks for the information. It was very useful.