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
相關文章
相關標籤/搜索