Google App Engine 上的 NestJS 项目显示错误“无法写入文件”&&“EROFS:只读文件系统”

2024-04-27

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

错误 TS5033:无法写入文件“/workspace/dist/properties/dto/property.filter.dto.d.ts”:EROFS:只读文件系统,打开“/workspace/dist/properties/dto/property.filter” .dto.d.ts'。

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 文件夹中写入文件,但我不确定为什么会发生这种情况。


As this 官方文档 https://cloud.google.com/appengine/docs/the-appengine-environments#comparing_high-level_features表示:

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

所以,这意味着只有在/tmp您将能够执行写入操作的目录以及您无法执行的任何其他操作,因为它们是只读的,其中包括workspace因此dist。正如这个类似案例的答案所澄清的那样here https://stackoverflow.com/a/60950921/12767257,您将需要在以下任一位置处理您的文件/tmp目录或开始使用 App Engine Flex,您可以在其他目录中写入。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Google App Engine 上的 NestJS 项目显示错误“无法写入文件”&&“EROFS:只读文件系统” 的相关文章

随机推荐