0

I have an electron app which writes to an excel file:

`var Excel = require('exceljs');
…
function writeExcel(dataList){
//do some stuff here
}
`

This works fine in development. However, after packaging it with electron packager, I have the following error:

`Uncaught (in promise) Error: EACCES: permission denied, open './Analysis.xlsx'`

I can't figure out what the problem is. Anyone able to provide some assistance? Thanks

  • are you using 'asar' to package your app? – Ishwar Rimal Oct 17 '17 at 08:25
  • No. I didn't use 'asar'. I used electron-packager. – Ryan O'Reilly Oct 17 '17 at 08:33
  • Oh. For me the problem was with asar package. Since it is read only, it was not giving me write permission. So I created the file (in runtime) to be written one directory above the current one, so that it is outside the package and the wrote into it. You cant try that way. – Ishwar Rimal Oct 17 '17 at 08:38
  • Better create the file in 'appPath' (var {app} = require('electron').remote; var appPath = app.getPath('userData');) and do the write operation here – Ishwar Rimal Oct 17 '17 at 08:40

0 Answers0