Unable to run project from vscode

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?

From [wn] it looks like you are running this through the WebNative plugin? Have you tried running the command yourself?

npx cap run ios -l

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.

I would review the steps here - Debugging |.

If you are still having issues, maybe create an issue on the repo - GitHub - damiant/vscode-webnative: Create and maintain web and native projects

Thanks much: will do.

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.

I found this problem when I was searching for FNM problems with MCP initializing in VSCode: Using fnm to launch MCP server in Visual Studio Code using specific node version fails · Issue #1406 · Schniz/fnm · GitHub