【问题标题】:node.js express-coffee Error: ENOENT, no such file or directorynode.js express-coffee 错误:ENOENT,没有这样的文件或目录
【发布时间】:2023-03-19 21:42:01
【问题描述】:

我安装了最新的express-coffee,也安装了node-config。我创建了一个简单的 src/config/default.yaml

Database:
    db_host: localhost
    db_name: test

在我的 src/models/index.coffee 中

config = require('config').Database

console.log "host: #{config.db_host}"

但是当尝试使用cake dev 甚至cake build && node app 启动服务器时,我收到以下错误:

Cannot write runtime.json file Error: ENOENT, no such file or directory

尝试在此处和 Google 上搜索该问题,但找不到任何内容。即使只是 ENOENT 或 node-config runtime.json 的少数点击也没有帮助。以前有其他人遇到过这个问题吗?

【问题讨论】:

    标签: node.js coffeescript express


    【解决方案1】:

    原来问题出在 config/default.yaml 所在的位置。我不得不将它移动到应用程序的根目录。将其移至根目录 - config/default.yaml 修复了该问题。 错误消息对于弄清楚发生了什么并没有多大帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-07
      • 2016-09-01
      • 2020-06-03
      • 2020-04-09
      • 1970-01-01
      • 1970-01-01
      • 2019-03-09
      相关资源
      最近更新 更多