vscode-react-native icon indicating copy to clipboard operation
vscode-react-native copied to clipboard

[Bug] Android debugging get spawn EINVAL error in windows, vscode 1.92

Open uganof opened this issue 1 year ago • 12 comments

🐛 What is the bug? How can we reproduce it?

In visual studio code 1.92.0 or 1.92.1 windows 11 or 10 when debugging android is launched display error: An error occurred while launching the application. spawn EINVAL (error code 303)

doing some research is linked to the indicated security change:

https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2

uganof avatar Aug 08 '24 17:08 uganof

Hey @uganof , thanks for reporting it. The bug fixing is in progress, any updates will comment here.

As a workaround, you can use native command npx react-native run-android to launch you application and use attach request to debug your app.

   {
            "name": "Attach to Hermes application",
            "request": "attach",
            "type": "reactnativedirect",
            "cwd": "${workspaceFolder}"
        }

EzioLi01 avatar Aug 09 '24 03:08 EzioLi01

Thank you!

uganof avatar Aug 09 '24 15:08 uganof

Hey @uganof , this issue should be fixed. Could you please uninstall existing extension and try on this one(Unzip and manually install .vsix file in vscode extension tab)? Any issue please let me know.

vscode-react-native-1.13.1.vsix.zip

lexie011 avatar Aug 12 '24 07:08 lexie011

Hi @lexie011, I installed the extension you attached and now it works correctly as before. Thank you

uganof avatar Aug 12 '24 15:08 uganof

@uganof Please use this extension for the debugging, currently microsoft pipeline is updating, after this we will work on new version release process.

EzioLi01 avatar Aug 13 '24 01:08 EzioLi01

@uganof I'm getting an error trying to use this extension. Pls provide me the solution.

[Info] Need to check main file and entry point of open module, will setup and write new content if they're not existing. Path: d:\new\admin project\admin\node_modules\open

[Info] Find open-main.js and entry in open module, skip setup...

[Info] Starting Packager

'd:\new\admin' is not recognized as an internal or external command, operable program or batch file.

ranjeetsingh98965 avatar Aug 13 '24 07:08 ranjeetsingh98965

@uganof I'm getting an error trying to use this extension. Pls provide me the solution.

[Info] Need to check main file and entry point of open module, will setup and write new content if they're not existing. Path: d:\new\admin project\admin\node_modules\open

[Info] Find open-main.js and entry in open module, skip setup...

[Info] Starting Packager

'd:\new\admin' is not recognized as an internal or external command, operable program or batch file.

Maybe you can rename folder without space. Like 'AdminProject', not 'admin project'.

EzioLi01 avatar Aug 13 '24 08:08 EzioLi01

Still doesn't work for my iOS. It just stuck after I click Attach to package

zhouhao27 avatar Aug 31 '24 09:08 zhouhao27

Hey @uganof , thanks for reporting it. The bug fixing is in progress, any updates will comment here.

As a workaround, you can use native command npx react-native run-android to launch you application and use attach request to debug your app.

   {
            "name": "Attach to Hermes application",
            "request": "attach",
            "type": "reactnativedirect",
            "cwd": "${workspaceFolder}"
        }

This one works. Thanks.

zhouhao27 avatar Aug 31 '24 09:08 zhouhao27

Hey @uganof , thanks for reporting it. The bug fixing is in progress, any updates will comment here.

As a workaround, you can use native command npx react-native run-android to launch you application and use attach request to debug your app.

   {
            "name": "Attach to Hermes application",
            "request": "attach",
            "type": "reactnativedirect",
            "cwd": "${workspaceFolder}"
        }

But which option to run to attach to android emulator ? all options give error image

Master-Servis avatar Sep 28 '24 21:09 Master-Servis

@Master-Servis Have you installed extension mentioned in this comment?

As mentioned in above related issue, the new version of extension is not released since MS is working on updating pipeline security policy and it's still in progress.

Also you can try to package and install your own .vsix file following this doc.

Will publish new version of extension once the pipeline is getting back.

EzioLi01 avatar Sep 29 '24 07:09 EzioLi01

Also you can try to package and install your own .vsix file following this doc.

Hi, extension did not work for me. I did the following:

Ran command npx react-native start --experimental-debugger

Then put json config:

{
  "configurations": [

    {
    "name": "Attach to Hermes application - Experimental",
    "request": "attach",
    "type": "reactnativedirect",
    "cwd": "${workspaceFolder}",
    "address": "localhost",
    "port": 8081
    }
  ]
}

And clicked run in debugger on top of already running reactapp.

That worked. Thanks.

Ref: https://github.com/microsoft/vscode-react-native/issues/1878#issuecomment-1334686256

Master-Servis avatar Sep 30 '24 17:09 Master-Servis

Hey @uganof , this issue should be fixed. Could you please uninstall existing extension and try on this one(Unzip and manually install .vsix file in vscode extension tab)? Any issue please let me know.

vscode-react-native-1.13.1.vsix.zip

Just to let you know, this is still happening with the last VSC version from the Extensions marketplace. I had to download your zip version in order to be able to debug and run the react native application on desktop (targeting widnows platform).

aurentium avatar Nov 03 '24 21:11 aurentium

Move this issue in #2254.

EzioLi01 avatar Dec 05 '24 02:12 EzioLi01

Hey @uganof , this issue should be fixed. Could you please uninstall existing extension and try on this one(Unzip and manually install .vsix file in vscode extension tab)? Any issue please let me know.

vscode-react-native-1.13.1.vsix.zip

Just made my day. Thanks

khsuzan avatar Jan 01 '25 07:01 khsuzan

So May 2025, I am still getting "Failed to start the React Native packager (error code 106)". I see the version of this hasn't changed in a year. Is it still a MS pipeline issue? any word on when newer versions of react native tools can be updated normally?

Looks like I will have to install the .zip, for now, just shocked that these comments are from so long ago.

Katerlad avatar May 08 '25 03:05 Katerlad

For me, it works with @EzioLi01 solution, just a little note, remember that the local server should be started.

Said that, try to run yarn start, before attach or as the solution mentioned run npx react-native run-android.

Image

soyaaroncervantes avatar Aug 11 '25 14:08 soyaaroncervantes