简体   繁体   English

加载db.json时出错

[英]I got an error when loading db.json

When I enter this command 当我输入此命令

sudo json-server db.json 

I got this error: 我收到了这个错误:

/usr/local/lib/node_modules/json-server/src/cli/utils/load.js:31
    data = low(source, { storage: fileAsync }).state()
                                               ^

TypeError: low(...).state is not a function
    at module.exports (/usr/local/lib/node_modules/json-server/src/cli/utils/load.js:31:48)
    at start (/usr/local/lib/node_modules/json-server/src/cli/run.js:99:5)
    at module.exports (/usr/local/lib/node_modules/json-server/src/cli/run.js:126:3)
    at module.exports (/usr/local/lib/node_modules/json-server/src/cli/index.js:86:3)
    at Object.<anonymous> (/usr/local/lib/node_modules/json-server/bin/index.js:2:22)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)

Can anyone help me please? 有人可以帮我吗?

I met the same problem, but fixed by uninstalling json-server module installed with --save-dev. 我遇到了同样的问题,但通过卸载安装了--save-dev的json-server模块修复了问题。 Try making read the module as a global one. 尝试将模块作为全局模块读取。

I met the same problem too, and I already installed json-server with -g . 我也遇到了同样的问题,我已经用-g安装了json-server。

I'm not sure if this is the same issue as this , but I fixed this problem by upgrading node version and re-installing json-server. 我不知道这是否是同样的问题,因为这个 ,但我通过升级节点版本并重新安装JSON-服务器解决了这个问题。

Hope those information will also help you. 希望这些信息也能帮到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM