本文介绍了Google App Engine上的NestJS项目显示错误“无法写入文件".&&"EROFS:只读文件系统"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在Google App引擎上部署NestJS项目时,我正在努力解决以下错误.

I am struggling to solve error as like below when i deploy NestJS project on Google App engine.

app.yaml 文件在下面

runtime: nodejs10
env: standard

default_expiration: "4d 5h"

## to specify database
beta_settings:
  cloud_sql_instances: "your instance connection name"

env_variables:
  DATABASE_HOST: "/cloudsql/your instance connection name"
  DATABASE_USERNAME: "user name"
  DATABASE_PASSWORD: "password"
  INSTANCE_CONNECTION_NAME: "your instance connection name"

handlers:
- url: /.*
  secure: always
  redirect_http_response_code: 301
  script: auto

resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10

tsconfig.json 文件在下面

{
  "compileOnSave": true,
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "ES2017",
    "sourceMap": true,
    "outDir": "./dist",
    "allowJs": true,
    "baseUrl": "./",
    "incremental": true
  }
}

似乎我无法在App Engine的dist文件夹中写入文件,但我不确定为什么会发生.

it seems i can not write files in dist folder on App Engine but i am not sure why it happens.

推荐答案

官方文档表示:

因此,这意味着只有在/tmp 目录中,您才能执行写操作,而其他任何您将无法执行的操作,因为它们都是只读的,其中将包括工作区,因此是 dist .正如在类似情况下在此处中回答的那样,您需要在/tmp中处理文件目录或开始使用App Engine Flex,您可以在其中编写其他目录.

So, this means that only in the /tmp directory you will be able to perform writting operations and any others you won't as they arey read-only, which will include the workspace and consequently the dist. As clarified in this answer from a similar case here, you will need to handle your files in either the /tmp directory or start to use App Engine Flex, where you can write in other directories.

这篇关于Google App Engine上的NestJS项目显示错误“无法写入文件".&&"EROFS:只读文件系统"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 20:59