Npm ERR! could not determine executable to run

Capacitor Doctor :pill:

Latest Dependencies:

@capacitor/cli: 6.0.0
@capacitor/core: 6.0.0
@capacitor/android: 6.0.0
@capacitor/ios: 6.0.0

Installed Dependencies:

@capacitor/cli: 6.0.0
@capacitor/ios: 6.0.0
@capacitor/android: 6.0.0
@capacitor/core: 6.0.0

Android build affected.

I was using docker image:

mingc/android-build-box:1.25.0

but now with version 6 of CLI I needed to upgrade NodeVersion. So, I upgraded to

mingc/android-build-box:1.26.0

And now when running

npx cap sync android

I get this error (verbose):

npm verb cli /usr/bin/node /usr/lib/node_modules/npm/bin/npm-cli.js 
npm info using npm@10.0.0 
npm info using node@v18.17.1  
npm verb title npm exec cap sync android  
npm verb argv "exec" "--loglevel" "verbose" "--" "cap" "sync" "android"  
npm verb logfile logs-max:10 dir:/root/.npm/_logs/2024-06-06T13_30_10_418Z- 
npm verb logfile /root/.npm/_logs/2024-06-06T13_30_10_418Z-debug-0.log

npm http fetch GET 200 https://registry.npmjs.org/cap 665ms (cache miss)  
npm verb stack Error: could not determine executable to run 
npm verb stack at getBinFromManifest (/usr/lib/node_modules/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js:17:23) 
npm verb stack at exec (/usr/lib/node_modules/npm/node_modules/libnpmexec/lib/index.js:188:15) npm verb stack at async module.exports (/usr/lib/node_modules/npm/lib/cli-entry.js:61:5) 
npm verb pkgid cap@0.2.1 
npm verb cwd /project 
npm verb Linux 5.4.0-90-generic 
npm verb node v18.17.1 
npm verb npm v10.0.0 
npm ERR! could not determine executable to run 
npm verb exit 1 
npm verb code 1

What could be the problem?

I solved the problem. The solution was that @capacitor/cli is a dev dependency and in this new image, npm wasn’t installing dev dependencies, thus npx cap was not installed and was not working.