I’m trying to run a project from vscode, but I’m receiving an error when I do so. It launches the iOS Simulator properly, but the app never runs/connects. (I can otherwise run it successfully from Xcode directly.)
The error is in the console is:
[wn] Running...
> npx cap run ios --target=8069AEFF-5931-4E5E-A4DB-B77F2FAE21FB --live-reload --no-sync --port=8100 --host=192.168.68.89 & npx undefined -- --host=192.168.68.89 --port=8100
npm ERR! could not determine executable to run
That “npx undefined” doesn’t look good. I’ve looked at the capacitor run scripts to see if I can track down where this is happening, but so far have been unable to. I’ve tried “npx cap add ios” to re-add/fix iOS support for the project, but that doesn’t make a difference.
Any suggestions as to what’s wrong and how to fix it?
I can definitely just run npx cap run ios directly, but it doesn’t allow me to debug using vscode (or, mainly, to see JS-produced console messages for debugging, which is what I’m really hoping to do). I assume what it’s trying to do is start a server(?), similarly to how I would run npx vite to run the web version locally, but for whatever reason there’s an undefined value somehow getting into the run script.
I was asking to see where the issue is. If it runs fine yourself, then it’s probably an issue with the WebNative plugin (or your configuration with it) and not the Capacitor CLI.
Is it possible that you are using NVM or FNM to manage node?
If that’s the case, when “extensions” launches any CMD command, will probably fail with an error similar to “didn’t find the npx command” or similar.