joshwcomeau / guppy

🐠A friendly application manager and task runner for React.js
ISC License
3.27k stars 154 forks source link

Use integrated Node if not otherwise installed #44

Open joshwcomeau opened 6 years ago

joshwcomeau commented 6 years ago

Right now, installing Guppy is a 2-step process:

Guppy is an electron app, though, and electron apps come with a built-in Node runtime! How cool would it be to no longer require a Node installation, by just using the bundled one if no system Node is found.

(I think we'd still want to use the system Node, when it's available, so that there's no difference between running scripts in a terminal vs. Guppy. But for the true beginner without Node, they shouldn't need to first worry about getting Node set up!)

If this proves to be challenging, we should at least prompt the user in-app to download Node if it isn't found (right now creating a project just fails mysteriously :/)

superhawk610 commented 6 years ago

This should be possible using ELECTRON_RUN_AS_NODE (https://github.com/electron/electron/issues/11515), per @GregorySchier on Twitter.

joshwcomeau commented 6 years ago

Yeah, awesome to hear that this is possible!

joshwcomeau commented 6 years ago

Note that we might want to hold off on this for a moment, as our switch to electron-builder (#26, #236) might affect how this works

joshwcomeau commented 6 years ago

Gonna start taking a look at this =D

joshwcomeau commented 6 years ago

Ok, so I've run into a number of issues with this. I think it's worth doing, but it's probably not worth blocking 0.3 over.

Moving it to 0.4

joshwcomeau commented 6 years ago

I asked on SO, to see if there's a simpler solution we're missing: https://stackoverflow.com/questions/52470403/how-do-i-use-electrons-built-in-node-instance-for-running-tasks

KenEucker commented 5 years ago

@joshwcomeau I followed your stack-overflow post to this project and wanted to check in with you and see if you were able to take advantage of the built in node for your project. I have a similar application that I am working on and being able to use the built in node would help me with a roadblock I am experiencing.

Did you find a solution for this?

AWolf81 commented 5 years ago

Not sure if Josh made any progress on this. I've tried to setup a minimal example with electron-fiddle and you can find the gist here.

But still no luck. But with the fiddle it's easier to test as you can start the binary of electron-fiddle and edit the project with-out a Node version in the system path.

The mentioned fork in the other SO question wasn't working. Seems like it's doing something in a separate thread with-out returning anything but I haven't check that. Any way we need exec/spawn for the app.

I need to check how to call the Electron helper Josh mentioned from Electron then I can try to find a solution for the issue mentioned in th SO question - yarn not finding node.