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\electron-v7.0.0-beta.5-win32-x64.zip'
(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

Details

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: '7.7.299.11-node.12',
  zlib: '1.2.11'
}
$ node -p process.platform
win32

Screenshots

Still the same issue:

  • I have tried complete uninstall of nodejs and npm (and also clear cache for both)
  • Creating a new user windows account and tried installing latest nodejs

I am having the same issue.
Tried running as administrator, deleted node_modules, etc.

I just tried creating 2 new VMs for windows 10 and windows 7 and same error. Uhg! I’v been unproductive for the last 2 days because of this!

This must be an issue with downloading the file.
I had the same error on my company laptop and could fix it by using the internet over my private mobile spot instead of the company network.

I don’t think so, because npm is able to download some other packages like chrome driver, and some native module binaries. Do note that other working downloads are in the folder other than tmp directory. While electron downloads in user tmp directory. Could this be an issue?