Electron app 'EPERM operation not permitted, rename' error when checking and creating folders on windows with node.js fs-extra

November 25, 2017, at 4:31 PM

This is a bit of a convoluted error that I simply can't figure out with my level of Electron and node.js understanding, so I'm really hoping it will be obvious to someone what's going wrong!

I have an Electron App I've almost finished developing, part of which retrieves a folder structure and it's files from Dropbox (using the Javascript SDK), and replicates it on the local machine, checking if they already exist as it goes, using node.js fs-extra module.

This has been working brilliantly, once I limited the simultaneous calls to the Dropbox API! I built and packaged the app for windows and mac (I'm developing on a mac, on which it works perfectly) and on windows it's throwing this really obscure error that I just can't made head nor tail of:

This is the scenario in which this gets thrown; imagine the following folder structure in Dropbox, not locally:

  1. I 'download' the 'De Sangosse' folder into my empty local directoy
  2. It walks the Dropbox directory and checks locally for the existence of the folders and files, finding none.
  3. It creates all the necessary folders, starting with 'Products' and downloads the files into the correct places.

Now I do this:

  1. I 'download' the 'Certis' folder, which obviously doesn't exist locally yet
  2. I walks the Dropbox directory and checks locally for the existence of the folders and files.
  3. It finds 'Products' exists, so doesn't try and create it...

It's at this point that the error is thrown, which I don't understand because I'm not trying to create this folder, I've just checked whether it exists or not with the following code:

    // folder exists
    console.log("folder_exists, don't do anything");
    // folder does not exist. Create it!

It correctly prints the 'folder exists' message to console before it errors, so I know it's not trying to overwrite a non-empty folder... and when I click ok, it carries on creating the correct files and folders in the correct places as if nothing has happened.

Can anyone shed any light on this...? I can't find a similar situation anywhere after a LOT of Googling and it's driving me mad!

Rent Charter Buses Company
How to get npm package to work in browser?

How to get npm package to work in browser?

I try to use bin-json in the browserThe readme mentions that this should work but i don't get it to work

Cheerio web scraping error

Cheerio web scraping error

I am trying to scrape http://wwwratemyprofessors

Set Messaging platform on Dialogflow v2

Set Messaging platform on Dialogflow v2

Is it possible to set messaging platform for DialogFlow when using DetectIntent from API?