首先,注意配置环境变量
依赖Python 2.7.15以上环境,请提前安装并配置环境变量。
C:\Users\[user-name]\AppData\Roaming\npm
,这个目录是npm i pkg-name -g
之后,可单独执行文件的默认目录。
npm i -g electron electron-builder
这个必选的,要不没法玩。
npm i -g windows-build-tools
这个也要装,打包用的。记得以管理员身份运行。
Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!
Status from the installers:
---------- Visual Studio Build Tools ----------
Successfully installed Visual Studio Build Tools.
------------------- Python --------------------
Python 2.7.15 is already installed, not installing again.
Now configuring the Visual Studio Build Tools..
All done!
+ windows-build-tools@5.2.2
Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (72)
解决办法:node-sass,https://github.com/sass/node-sass/releases/tag/v4.11.0
set SASS_BINARY_PATH=C:\Stock\win32-x64-67_binding.node
npm install node-sass
could not use PowerShell to find Visual Studio 2017 or newer
npm install -g node-gyp
’vue-cli-service’ 不是内部或者外部命令,也不是可运行的程序
删除node_modules目录,删除package-locl.json重新执行install。
’electron-builder’ 不是内部或外部命令,也不是可运行的程序
配置环境变量:%USERPROFILE%\AppData\Roaming\npm
Quick Start
https://github.com/electron/electron-quick-start
# Clone this repository
git clone https://github.com/electron/electron-quick-start
# Go into the repository
cd electron-quick-start
# Install dependencies
npm install
# Run the app
npm start