bug:step-5: problem with json-server (potential fix)
cliffordfajardo opened this issue · comments
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 runnpm 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 =).