在此只介绍Mac安装Electron遇到的问题,供大家参考。
1.首先安装包管理工具Homebrew。
参考网址:https://brew.sh/
执行命令:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
查看版本信息
brew -v
2.安装好Homebrew后,用它安装npm。
执行命令:brew install node
查看版本信息
node -v
npm -v
3.更改Electron的镜像地址
默认镜像地址下载速度慢,容易卡死。
执行命令:export ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/"
4.安装Electron
执行命令:npm --registry=http://registry.npm.taobao.org install electron
5.运行应用
执行命令:npm start