- 查看 node 版本:
node -v
C:\Users\xuxiaowei>node -v v12.16.0 C:\Users\xuxiaowei>
- 設置組件路徑與緩存路徑:
npm config set prefix "D:\Program Files\nodejs\node_global"
npm config set cache "D:\Program Files\nodejs\node_cache"
- 設置淘寶源與安裝淘寶cnpm:
npm config set registry=https://registry.npm.taobao.org
npm install -g cnpm --registry=https://registry.npm.taobao.org
- 使用淘寶 cnpm 全局安裝 vue cli:
cnpm install -g @vue/cli
- 使用淘寶 cnpm 全局安裝 electron:
cnpm install -g electron
- 使用淘寶 cnpm 全局安裝 vue cli-init:
cnpm install -g @vue/cli-init
- 創建項目:
項目名:Electron-Vuevue init simulatedgreg/electron-vue Electron-Vue
- 程序名稱?
名稱不能有大寫:? Application Name electron-vue
- ID?
? Application Id cn.com.xuxiaowei
- 版本號?
? Application Version 0.0.1
- 項目描述?
? Project description 一個 Electron Vue 項目
-
? Use Sass / Scss? No
- 選擇使用 Vue 組件?
? Select which Vue plugins to install (Press <space> to select, <a> to toggle all, <i> to invert selection)axios, vue-el ectron, vue-router, vuex, vuex-electron
- 使用 ESLint?
? Use linting with ESLint? Yes
- ESLint 風格?
參見:
Standard
Airbnb? Which ESLint config would you like to use? Standard
-
? Set up unit testing with Karma + Mocha? No
-
? Set up end-to-end testing with Spectron + Mocha? No
electron-builder
electron-packager? What build tool would you like to use? builder
-
? author 徐曉偉 <[email protected]>
- 程序名稱?
- 安裝組件:
進入項目文件夾:E:\GitHub>cd Electron-Vue E:\GitHub\Electron-Vue>
cnpm install
- 運行項目:
npm run dev
- 可能會報錯:
Html Webpack Plugin: ReferenceError: process is not defined - index.ejs:11 eval [.]/[[email protected]@html-webpack-plugin]/lib/loader.js!./src/index.ejs:11:2 - index.ejs:16 module.exports [.]/[[email protected]@html-webpack-plugin]/lib/loader.js!./src/index.ejs:16:3 - index.js:284 [Electron-Vue]/[[email protected]@html-webpack-plugin]/index.js:284:18 - task_queues.js:97 processTicksAndRejections internal/process/task_queues.js:97:5
在 .electron-vue/webpack.renderer.config.js 中,新增:templateParameters(compilation, assets, options) { return { compilation: compilation, webpack: compilation.getStats().toJson(), webpackConfig: compilation.options, htmlWebpackPlugin: { files: assets, options: options }, process, }; },
Electron Vue 項目搭建
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.