Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug:step-5: problem with json-server (potential fix) #8

Open
cliffordfajardo opened this issue May 14, 2016 · 0 comments
Open

bug:step-5: problem with json-server (potential fix) #8

cliffordfajardo opened this issue May 14, 2016 · 0 comments

Comments

@cliffordfajardo
Copy link

If you get the message below from JSON-server see: TypeError: low(...).state is not a function.

 \{^_^}/ hi!

  Loading db.json
/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:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)

TDLR:

  • json-server's dependencies may be out of date, so you will need to find the global package on your computer. Mine was at: usr/local/lib/node_modules/json-server.
  • using your editor, go to json-server 's package.json file & remove all of the upticks ^ in front of all of the package's version numbers. Next ...
  • delete node_modules then run npm install

I misunderstood & removed the ^ from the project I was using instead of the actual json-server package located on my computer at usr/local/lib/node_modules/json-server/. Once I removed the ^ from the package.json inside of the json-server package (usr/local/lib/node_modules/json-server/), deleted the node_modules folder & did npm install my json-server package began to work again =).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant