6月29 Electron的第一課

官方文檔

https://www.electronjs.org/docs

部署常識

1、首先,安裝最新版本的Node.js 。
https://www.electronjs.org/docs/tutorial/development-environment#setting-up-macos

# 下面這行的命令會打印出Node.js的版本信息
node -v

# 下面這行的命令會打印出npm的版本信息
npm -v

2、npm鏡像源管理

1、查看npm源地址
npm config list

結果:
metrics-registry = "http://registry.npm.taobao.org/"

2、修改registry地址,比如修改爲淘寶鏡像源。
npm set registry https://registry.npm.taobao.org/
用rm命令刪掉它
npm config rm registry

3、或者是npm鏡像

直接執行
npm install --registry=https://registry.npm.taobao.org

4、部署electron
https://www.electronjs.org/docs/tutorial/first-app
兩種選擇

  • 全局:npm install electron -g
  • 局部:進入文件夾後,執行:
npm init
npm install --save-dev electron --registry=https://registry.npm.taobao.org

5、helloworld:

https://github.com/electron/electron-quick-start

# 克隆這倉庫
$ git clone https://github.com/electron/electron-quick-start
# 進入倉庫
$ cd electron-quick-start
# 安裝依賴庫
$ npm install
# 運行應用
$ npm start
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章