3

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?

Rob Kielty
  • 7,958
  • 8
  • 39
  • 51
Trung Nguyen
  • 51
  • 2
  • 4

2 Answers2

0

I met the same problem, but fixed by uninstalling json-server module installed with --save-dev. Try making read the module as a global one.

okapie
  • 1
  • 1
0

I met the same problem too, and I already installed json-server with -g.

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.

Hope those information will also help you.

tmthydvnprt
  • 10,398
  • 8
  • 52
  • 72
Andrew - oahehc
  • 511
  • 1
  • 4
  • 13