0

I'm using chartjsimage to convert charts into image and store them locally using the function .toFile. It works perfect in my local machine, but when i deploy it to azure web app, i get the following error.

{ Error: ENOENT: no such file or directory, open 
'D:\home\site\wwwroot\public\images\image1.png'at 
Object.openSync (fs.js:439:3)at Object.writeFileSync (fs.js:1190:35)
at ChartJsImage.toFile (D:\home\site\wwwroot\node_modules\chartjs-to-image\index.js:136:8)at 
process._tickCallback (internal/process/next_tick.js:68:7)errno: -4058,syscall: 'open',code: 
'ENOENT',path:'D:\\home\\site\\wwwroot\\public\\images\\image1.png' }

I thought that maybe i don't have access to local file system in Azure web app, but when i checked this link i found that it is actually possible to manipulate files inside D:\home

--UPDATE-- I tried to create the file from the terminal, and run with the same code again, i got the following error.

{
   "errno": -4048,
   "syscall": "write",
   "code": "EPERM"
}

I think it's permession problem

Random
  • 355
  • 1
  • 3
  • 12
  • It's not permissions error, it is `file not exist` error. Did you check if the file exist? – yeya May 10 '21 at 14:32
  • i'm using writeFileSync function to create the file, i'm trying the create a file here not reading one. writeFileSync should create the file if it does not existe – Random May 10 '21 at 14:37
  • So I guess the folder not exist. – yeya May 10 '21 at 14:39
  • can u check my question update – Random May 10 '21 at 14:49
  • It is not clear what you have done in the terminal. Can you create the folder or the file from the terminal or not? What is the current folder permission? (check with `ls -l` on terminal) – yeya May 11 '21 at 08:51

1 Answers1

0

Check this

Create the folder with recursive mkdir and then save the file.

yeya
  • 1,968
  • 1
  • 21
  • 31