Variations on Electron Install


#1

In an article (Creating Your First Electron App) the author talks about installing Electron as a project dependency.

How is this different from installing Electron globally?

And if I have Electron installed globally, do I still need to install it as a dependency for a project?

And if that’s the case, do I need to do it every time I create a new project?

And if that’s the case, what’s the point of installing Electron globally?


#2

Global packages can be used by all of your projects and will be used if there’s no local package to be found. This is mostly done for utilities like Gulp, Grunt, Yo, etc. that are used across many projects.

And if I have Electron installed globally, do I still need to install it as a dependency for a project?

Unlikely. You would if your global Electron was of an older version than the project required or if the project specifically required an older version for some reason.

And if that’s the case, do I need to do it every time I create a new project?
And if that’s the case, what’s the point of installing Electron globally?

Well, if you have Electron installed globally, and there’s a dependencies.electron entry in your package.json, you can just let npm install decide whether your global version is good enough (see above). If you’re developing for Electron, you’re probably just going to be using the latest versions, so install it globally and keep all of your projects in sync.


#3

Thanks, DamnedScholar. I do believe that clears everything up. :slight_smile: