Electron - 初体验
Electron 的安装
使用 electron-forge 脚手架
> npm install -g electron-forge npm WARN deprecated : <3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of npm WARN deprecated : cross-spawn no longer requires a build toolchain, use it instead npm WARN deprecated : request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated : wrench.js is deprecated! You should check out fs-extra (https://github.com/jprichardson/node-fs-extra) for any operations you were using wrench for. Thanks for all the usage over the years. npm WARN deprecated : This module relies on Node.js‘s internals and will break at some point. Do not use it, and update to npm WARN deprecated : Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue > electron-forge init my-app electron-forge : 无法加载文件 C:\Users\****\AppData\Roaming\npm\electron-forge.ps1,因为在此系统上禁止运行脚本。有关详 细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。 所在位置 行:1 字符: 1 + electron-forge init my-app + ~~~~~~~~~~~~~~ + CategoryInfo : SecurityError: (:) [],PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess
安装过程正常,但是创建项目出现问题,原因是需要开启一个注册表的权限许可
- windows 左下搜 powershell,管理员运行
- 按照报错信息处理重新初始化即可
使用官方推荐的初始化项目包
克隆示例项目的仓库
git clone https://github.com/electron/electron-quick-start
进入这个仓库
cd electron-quick-start
安装依赖并运行
npm install
npm start
安装过程有一个文件下载很慢
Downloading electron-v9.0.5-win32-x64.zip: [-----------------------------------------------------] 0% ETA: 0.0 seconds 终止批处理操作吗(Y/N)? y
设置单个包的安装地址,将其指向淘宝镜像
npm set ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/
继续安装就可以了
看到这个界面就是成功了
相关推荐
游走的豚鼠君 2020-11-10
sanallen 2020-07-04
sanallen 2020-06-14
moyigg 2020-06-09
疯狂老司机 2020-06-07
zhujuyu 2020-06-06
moyigg 2020-06-01
zhujuyu 2020-05-30
viewerlin 2020-05-29
zhujuyu 2020-05-28
yanchuncheng 2020-05-12
Trustport 2020-05-06
chenyijun 2020-05-05
electronvolt 2020-05-04
游走的豚鼠君 2020-05-01
electronvolt 2020-04-21
游走的豚鼠君 2020-04-18
electronvolt 2020-04-15