jhen0409 / react-native-debugger

The standalone app based on official debugger of React Native, and includes React Inspector / Redux DevTools
MIT License
10.36k stars 809 forks source link

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

Open DanilVelichko opened 1 year ago

DanilVelichko commented 1 year ago

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!

Seagullie commented 1 year ago

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

DanilVelichko commented 1 year ago

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

AmrikTheProgrammer commented 1 year ago

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

Nashit2401 commented 1 year ago

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

gupta-karan1 commented 1 year ago

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.

aleksandarbos commented 1 year ago

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

pjsandwich commented 2 months ago

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