Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 我能';t使用节点js在Azure web app中创建文件_Node.js_Azure_Azure Web App Service - Fatal编程技术网

Node.js 我能';t使用节点js在Azure web app中创建文件

Node.js 我能';t使用节点js在Azure web app中创建文件,node.js,azure,azure-web-app-service,Node.js,Azure,Azure Web App Service,我使用chartjsimage将图表转换为图像,并使用函数.toFile本地存储它们。它在我的本地机器上工作得非常好,但是当我将它部署到azure web app时,我得到了以下错误 { 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.

我使用chartjsimage将图表转换为图像,并使用函数.toFile本地存储它们。它在我的本地机器上工作得非常好,但是当我将它部署到azure web app时,我得到了以下错误

{ 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' }
{
   "errno": -4048,
   "syscall": "write",
   "code": "EPERM"
}
我想我可能无法访问Azure web app中的本地文件系统,但当我检查此项时,我发现实际上可以操作D:\home中的文件

--更新-- 我试图从终端创建文件,并再次使用相同的代码运行,我得到了以下错误

{ 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' }
{
   "errno": -4048,
   "syscall": "write",
   "code": "EPERM"
}
我想是移位的问题

检查


使用递归
mkdir
创建文件夹,然后保存文件。

这不是权限错误,而是
文件不存在
错误。你检查过文件是否存在吗?我正在使用writeFileSync函数创建文件,我正在尝试在此处创建文件,而不是读取文件。如果文件不存在,writeFileSync应该创建该文件,因此我猜该文件夹不存在。你可以检查我的问题更新吗?不清楚你在终端中做了什么。您是否可以从终端创建文件夹或文件?什么是当前文件夹权限?(在终端上用
ls-l
检查)