I set a JSON file to use as a little practice database, but I can't run the server.
I've already tried to install (and reinstall) json-server global and locally npm install -g json-server
and npm install json-server
and then run json-server --watch db.json
, but it doesn't work.
I've also tried to set a script in the package.json file "load": "json-server --watch db.json"
and run the script node load
.
But nothing seems to work and I keep getting in return the message:
"'json-server' command not found"
or, in Portuguese:
"'json-server' não é reconhecido como um comando interno ou externo, um programa operável ou um arquivo em lotes".
How can I fix this?
Try:
npx json-server --watch db.json
Solution: For Linux:
Firstly, run this command to globally install json-server
sudo npm install -g json-server
Move to your local folder(like my-app) and run this command
npm install json-server
Open a new Terminal in the same folder
json-server --watch db.json --port 3004
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With