1

我是 Google Cloud 资源的新手。

我正在谷歌云的应用程序引擎上部署 Nodejs(使用 Markojs)应用程序,我收到错误“EROFS:只读文件系统,打开'/srv/src/app/converter/form/.7.1565968890124.converter。 marko.js'"

在 Google 文档中说“文件系统运行时包括一个完整的文件系统。文件系统是只读的,除了位置 /tmp,它是在您的 App Engine 实例的 RAM 中存储数据的虚拟磁盘。”

链接:https ://cloud.google.com/appengine/docs/standard/nodejs/runtime#filesystem

我从“生产环境”运行“echo $PATH”,得到“/srv/node_modules/.bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/ sbin:/bin"

我正在尝试设置环境变量“PATH”以将路径“/srv/.node_modules 修复为 /tmp/.node_modules”。不知道能不能解决问题。

在我写的 app.yaml 文件中,

#   Copyright 2018, Google LLC.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# [START runtime]
runtime: nodejs10

env_variables:
  ## Put production environment variables here.
  ## PATH: /tmp/node_modules/.bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  PATH: /tmp/node_modules/.bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  _: /tmp
  HOME: /tmp

完整的错误是:

错误:EROFS:只读文件系统,在 Object.writeFileSync 的 Object.openSync (fs.js:443:3) 处打开“/srv/src/app/converter/form/.7.1565968890124.converter.marko.js”( fs.js:1194:35) 在编译 (/srv/node_modules/marko/dist/node-require/index.js:61:16) 在 Object.markoRequireExtension [as .marko] (/srv/node_modules/marko/dist /node-require/index.js:115:27) 在 Module.load (internal/modules/cjs/loader.js:653:32) 在 tryModuleLoad (internal/modules/cjs/loader.js:593:12) 在Function.Module._load (internal/modules/cjs/loader.js:585:3) 在 Module.require (internal/modules/cjs/loader.js:690:17) 在 require (internal/modules/cjs/helpers. js:25:18)
在 Bin2DecView.get 模板 [作为模板] (/srv/src/app/converter/Bin2DecView.js:9:16)

非常感谢您!

4

1 回答 1

2

默认情况下,该marko/node-require钩子会写入文件系统,但您可以对其进行配置:

require("marko/node-require").install({
  writeToDisk: false
});

src/compiler/config.js#L32-L37

于 2019-08-16T20:55:19.867 回答