前置:安装>=9.3的nodejs
在系统用户文件夹找到.npmrc文件并添加以下内容:
npm配置文件内容
prefix=c:\nodejs\node_global#nodejs的global目录
cache=c:\nodejs\node_cache#nodejs的缓存
msvs_version=2019#设置electron的C++编译器为visual studio 2019
home=https://www.npmjs.org#nodejs的home
ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/#electron镜像
ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/#electron-builder的编译镜像
strict-ssl=false#设置可以使用http
registry=https://registry.npmmirror.com/#设置npm 镜像
language=english#语言
python=C:\Users\11576\AppData\Local\Programs\Python\Python312\python.exe#设置python目录
disturl=https://registry.npmmirror.com/-/binary/node#设置nvm的nodejs镜像源
electron_mirror=https://registry.npmmirror.com/-/binary/electron/#electron的编译镜像
全局安装node-gyp
npm install node-gyp -g
下载安装visual studio 2019
https://visualstudio.microsoft.com/zh-hans/vs/older-downloads/
下载安装python3.2
https://www.python.org/download/releases/3.2/
标签:node,nodejs,开始,配置,环境,electron,https,npmmirror,com From: https://www.cnblogs.com/Waking/p/18429586