The Dark Knight
The Dark Knight

Reputation: 5585

How to run json-server in windows?

I have installed json-server using npm in Windows. Now when I try to run the json-server command from the Windows command prompt, I get this error: json-server is not recognized as an internal or external command, operable program or batch file.

Does anybody have any info on what is required to be changed here?

Upvotes: 2

Views: 13824

Answers (2)

hoseinsalimi
hoseinsalimi

Reputation: 1

  1. Run this in PowerShell npm install -g json-server
  2. Run json-server .\db.json

After this your server should be running on http://localhost:3000/posts

Upvotes: 0

LeoS
LeoS

Reputation: 61

Try this (with npm versions after 5.2.0): npx json-server db.json

Upvotes: 6

Related Questions