简体   繁体   English

如何在同一台计算机上使用两个版本的Electron

[英]How do I use two versions of Electron on the same machine

When I first started to learn Election the book I was using recommended that it be installed using npm install -g electron. 当我刚开始学习Election时,我正在使用的书建议使用npm install -g electronic进行安装。 Now I read on the npm website that npm install electron --save-dev is the preferred way to install it. 现在我在npm网站上读到npm install electronic --save-dev是安装它的首选方法。

So I created a new project directory and ran npm init then ran npm install electron --save-dev. 因此,我创建了一个新的项目目录,并运行npm init,然后运行npm install electronic --save-dev。 According to package.json Electron 1.7.5 was installed, but when I type electron in the project directory it reports version 1.6.10 which is the version that was installed with the -g option. 根据package.json的说明,安装了Electron 1.7.5,但是当我在项目目录中键入electron时,它将报告版本1.6.10,这是使用-g选项安装的版本。

Is there a way to get my new project to use 1.7.5? 有没有办法让我的新项目使用1.7.5? I have already completed a small project using version 1.6.10 and don't want to do anything that would keep it from running. 我已经使用1.6.10版完成了一个小项目,并且不想做任何会使它无法运行的事情。

Thanks, Jim 谢谢,吉姆

You can run the local version of electron out of the node_modules/.bin directly -- most likely it will be called node_modules/.bin/electron . 您可以直接在node_modules/.bin运行电子的本地版本-最有可能将其称为node_modules/.bin/electron

You can use npm or gulp (or even a shellscript/batch file) to run the app for you. 您可以使用npmgulp (甚至shellscript /批处理文件)为您运行该应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM