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

Error launching JS inspector: _open(...).default.openApp is not a function

Open DanilVelichko opened this issue 2 years ago • 7 comments

I've installed last version on my Windows 11 and after click on Open JS Debugger on Android emulator - the error on terminal in Visual Studio Code - Error launching JS inspector: _open(...).default.openApp is not a function. Help!

DanilVelichko avatar May 10 '23 08:05 DanilVelichko

Had same issue and managed to figure out a workaround.

I modified the default export in node_modules\open\open-main.js to include .openApp():

module.exports = {
    openMain: function (target, opts) {
        if (process.env.REACT_DEBUGGER) {
            if (opts.app) {
                console.log("Debugger for React Native is configured. Skipping launch of " + opts.app);
            }
            return;
        }

        return open(target, opts);
    },
    openApp: open.openApp,
};

And now I can launch the debugger 🤔 I'm on Windows 10, btw

Seagullie avatar May 16 '23 21:05 Seagullie

Coool! It's working now!! Tnx a lot!

DanilVelichko avatar May 17 '23 12:05 DanilVelichko

@Seagullie could you explain why this feature does not work straight out of the box when just installing expo?

AmrikTheProgrammer avatar May 18 '23 14:05 AmrikTheProgrammer

@Seagullie I tried the changes that you implemented but it is still giving the same error. I am on Windows 11 if that matters.

Nashit2401 avatar Jun 13 '23 10:06 Nashit2401

Had same issue and managed to figure out a workaround.

I modified the default export in node_modules\open\open-main.js to include .openApp():

module.exports = {
    openMain: function (target, opts) {
        if (process.env.REACT_DEBUGGER) {
            if (opts.app) {
                console.log("Debugger for React Native is configured. Skipping launch of " + opts.app);
            }
            return;
        }

        return open(target, opts);
    },
    openApp: open.openApp,
};

And now I can launch the debugger 🤔 I'm on Windows 10, btw

Yup, this works! I changed the open-main.js file and added the "jsEngine": "hermes", to the app.json file.

gupta-karan1 avatar Jul 05 '23 23:07 gupta-karan1

i've installed as a direct requirement via npm install open, for some reason applying that patch didn't work for me.

aleksandarbos avatar Jul 07 '23 16:07 aleksandarbos

I had this issue and editing the node module didn't work, but deleting node_modules and package.lock.json or yarn.lock abd then re-installing packages magically fixed this for me. I should say it worked for me, then stopped working, so it's not like I've never been able to get it to work like some people may be experiencing

pjsandwich avatar Jul 25 '24 15:07 pjsandwich