也可以这里下载:https://fossies.org/windows/www/electron-v1.4.5-win32-x64.zip/
先安装 nodejs
更新源:
如果是windows,用管理员打开cmd 或者git-cmd
- npm config set registry "https://registry.npm.taobao.org/" 或者 npm install -g cnpm --registry=https://registry.npm.taobao.org
- npm install -g electron
-
可以从淘宝提供的镜像中安装替代的包管理器
cnpm
,该安装源由淘宝提供和管理,定期与官方源同步,经过测试,下载速度很理想。使用cnpm
替代npm
,同样能够实现开发包管理。但是,如果你还是习惯使用npm
进行包管理,那么,可以通过安装镜像管理器nrm
来在不同的源中无缝切换。先用
cnpm
安装nrm
cnpm install -g nrm
然后
nrm ls
能够看到所有的源
# npm ---- https://registry.npmjs.org/ # cnpm --- http://r.cnpmjs.org/ #* taobao - http://registry.npm.taobao.org/ # nj ----- https://registry.nodejitsu.com/ # rednpm - http://registry.mirror.cqupt.edu.cn # npmMirror https://skimdb.npmjs.com/registry
通过
nrm use cnpm
可以选择使用
cnpm
作为默认的安装源,此时,使用npm
将会默认从淘宝安装源进行安装。 -
进行Electron开发之前,先要部署开发环境,在有node.js开发环境的基础上,可以通过
npm
进行开发环境的安装。安装有两种方式
-
全局安装
# Install the `electron` command globally npm install electron-prebuilt -g
-
当前目录下安装
# Install as a development dependency npm install electron-prebuilt --save-dev
二者选一个即可。
安装完成后建立app目录,然后将官网的quick-start中的内容分别拷贝到package.json,main.js,index.html下。
运行命令
cd app electron .
即可看到hello world程序运行。
-