Error: EPERM: operation not permitted, lstat

What I Wanted to Do

Unable to install Electron version >=7

What Happened Instead

Download fails with permission denied error:

(node:11316) UnhandledPromiseRejectionWarning: Error: EPERM: operation not permitted, lstat 'D:\Temp\electron-download-rhxH2G\'
(node:11316) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

Reproduction Steps

npm install electron@beta on windows


So far I have tried these options:

  • Disabled Windows defender
  • Tried recreating temp folder
  • Tried changing path of temp folder (even changed drive)
  • Adding everyone to the security of the temp folder
  • Updating npm
  • Running CMD as Administrator
  • Making sure that run nodejs always run as administrator

Platform Info

$ npm --versions
  'image-parsing': '0.0.1',
  npm: '6.11.3',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '35.1',
  http_parser: '2.8.0',
  icu: '64.2',
  llhttp: '1.1.4',
  modules: '72',
  napi: '5',
  nghttp2: '1.39.2',
  node: '12.11.1',
  openssl: '1.1.1c',
  tz: '2019a',
  unicode: '12.1',
  uv: '1.32.0',
  v8: '',
  zlib: '1.2.11'
$ node -p process.platform