如何解决我的 json-server 的 ENOENT 错误?

问题描述

我在下面收到此错误

PS C:\Users\Tan Shi Yu\Github\shopaway> npx json-server --watch data/db.json

  \{^_^}/ hi!

  Loading data/db.json
  Oops,data/db.json doesn't seem to exist
  Creating data/db.json with some default data

Error: ENOENT: no such file or directory,open 'data/db.json'
    at Object.openSync (fs.js:498:3)
    at Object.writeFileSync (fs.js:1524:35)
    at C:\Users\Tan Shi Yu\Github\shopaway\node_modules\json-server\lib\cli\utils\load.js:44:12
    at new Promise (<anonymous>)
    at module.exports (C:\Users\Tan Shi Yu\Github\shopaway\node_modules\json-server\lib\cli\utils\load.js:38:10)
    at start (C:\Users\Tan Shi Yu\Github\shopaway\node_modules\json-server\lib\cli\run.js:112:12)
    at module.exports (C:\Users\Tan Shi Yu\Github\shopaway\node_modules\json-server\lib\cli\run.js:149:3)
    at module.exports (C:\Users\Tan Shi Yu\Github\shopaway\node_modules\json-server\lib\cli\index.js:86:3)
    at Object.<anonymous> (C:\Users\Tan Shi Yu\Github\shopaway\node_modules\json-server\lib\cli\bin.js:6:14)
    at Module._compile (internal/modules/cjs/loader.js:1068:30) {
  errno: -4058,syscall: 'open',code: 'ENOENT',path: 'data/db.json'
}

但是,我相信我的文件安装在正确的位置,如图所示。

enter image description here

我可以知道我是否做错了什么吗?谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...