Google App Engine - Node.js - 错误:ENOENT

问题描述 投票:0回答:1

我正在使用运行 Node.js 的 Google App Engine,该引擎在我的 Android Studio 应用程序中返回 null 值。 Logcat 看起来不错,但 Google App Engine 控制台返回错误:

错误:ENOENT:没有这样的文件或目录,mkdir '/foldername/foldername'

我的index.js文件中适用的代码是:

'''
app.post('/update-account', async (req,res)=>{
    //const dir = "./foldername/"foldername
    const dir = "/foldername/"+foldername
    try {
        fs.mkdirSync(dir, { recursive: true }, function(err) {
            if (err) {
              console.log(err)
            } else {
              console.log("New directory successfully created.")
            }
        }) 
'''

我认为这可能是 Google App Engine 中的权限错误???文件夹名称是基于帐户数据的变量。我看过其他有关 ENOENT 错误的类似帖子,并尝试了几种解决方案,但没有一个为我解决了该问题。任何想法都非常感激!

node.js google-app-engine mkdir
1个回答
0
投票

不相信它会为您工作,因为您似乎正在尝试在文件系统中创建一个文件夹,但 Google App Engine 标准不支持这一点(请参阅文档)。您只能写入

tmp
目录

写入本地磁盘

Java 8、Java 11、Java 17、Node.js、Python 3、PHP 7.X、PHP 8.1、Ruby、Go 1.11 和 Go 1.12+ 具有对 /tmp 目录的读写访问权限

© www.soinside.com 2019 - 2024. All rights reserved.