Software Programming

Kunuk Nykjaer

json-server is not recognized as an internal or external command

leave a comment »


if you want to run npm json-server on a windows the command json-server might not exists.

It’s probably because your missing this on the system PATH variable:
C:\Users\YOUR_NAME\AppData\Roaming\npm

You should check and add it if it is not already added, then open a new console and try again.

Alternatively you can start the server (requires nodejs and json-server installed) in the command prompt with:
node “C:\Users\YOUR_NAME\AppData\Roaming\npm\node_modules\json-server\bin\index.js” db.json

 

Or you create a bat-file and name it run-json-server.bat with the content:
node “C:\Users\YOUR_NAME\AppData\Roaming\npm\node_modules\json-server\bin\index.js” %1 %2 %3 %4 %5

E.g. to start the server on port 3001 and with a db.json file.
run-json-server -p 3001 db.json

Advertisements

Written by kunuk Nykjaer

February 21, 2015 at 4:37 pm

Posted in Development

Tagged with ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: