npm electron 文档

  • npm清除下载缓存 npm cache clean -f
  • npm包安装,打印下载列表
    npm install electron --verbose
  • electron 安装
  1. 代理设置(文件为C:\Users\colin\.npmrc,没有能够本身手动建立)
home=https://npm.taobao.org
registry=https://registry.npm.taobao.org/
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs
electron_mirror=https://npm.taobao.org/mirrors/electron/
  1. 安装命令 npm install electron -g
  • 报错:UnhandledPromiseRejectionWarning: Error: EPERM: operation not permitted
  1. 手动下载“https://npm.taobao.org/mirrors/electron/7.1.5/electron-v7.1.5-win32-x64.zip” 至“node_modules\electron”
  2. 修改文件:node_modules\electron\install.js
//修改前:
// downloads if not cached
downloadArtifact({
  version,
  artifactName: 'electron',
  force: process.env.force_no_cache === 'true',
  cacheRoot: process.env.electron_config_cache,
  platform: process.env.npm_config_platform || process.platform,
  arch: process.env.npm_config_arch || process.arch
}).then((zipPath) => extractFile(zipPath)).catch((err) => onerror(err))

修改后:
// downloads if not cached
zipPath = "./electron-v7.1.5-win32-x64.zip";
extractFile(zipPath)
  1. 在node_modules\electron目录下执行node install.js
相关文章
相关标签/搜索