1、Electron 开发环境的安装

1、安装nodejs

node --version #查看node的版本

如果没有安装就是百度或(待续一篇安装)

npm config ls   #查看node安装及配置路径

显示如下:

C:Usersxrl>npm config ls
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.12.1 node/v12.13.1 win32 x64"

; userconfig C:Usersxrl.npmrc
cache = "D:\SoftWare\nodejs\node_cache"
prefix = "D:\SoftWare\nodejs\node_global"

; builtin config undefined

; node bin location = D:SoftWare
odejs
ode.exe
; cwd = C:Usersxrl
; HOME = C:Usersxrl
; "npm config ls -l" to show all defaults.
View Code

为了保留C盘的剩余空间,有必要,把 npm的 global 路径修改到其他盘符下

npm config set cache "D:SoftWare
odejs
ode_cache"
npm config set prefix "D:SoftWare
odejs
ode_global"

2、安装Electron

npm install -g cnpm -registry=https://registry.npm.taobao.org #安装cnpm
View Code

 注意:安装后把cnpm文件夹设置环境变量

npm install electron -g #安装  或 cnpm install electron -g #如果没有安装 cnpm须安装一下
electron -v #查看electron版本,查看是否安装
npm update electron -g #更新electron版本

安装成功能如下:

C:WINDOWSsystem32>electron -v

C:WINDOWSsystem32>"node"  "D:SoftWare
odejs
ode_global\node_moduleselectroncli.js" -v

v11.3.0
View Code

通过直接运行:electron 应该能出现一个界面说明对了

御载:

npm uninstall electron #御载

问题1:

没有试过记录一下:https://www.kanzhun.com/jiaocheng/387797.html

error Command "electron-serve" not found. Did you mean "electron:serve"?

npm install electron-serve -g

下一篇:2、Electron Hello Word!

node
原文地址:https://www.cnblogs.com/xiaoruilin/p/14452517.html