1

I've forked a project from GitHub, and I want to run the command npm run sjs, but it gives me an error. This is what it says:

> vodafone@0.1.0 sjs C:\Users\audre\fantastic-website\vodafone\vodafone
> json-server ./data/phones.json -p 1234 --watch

'json-server' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vodafone@0.1.0 sjs: `json-server ./data/phones.json -p 1234 --watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vodafone@0.1.0 sjs script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\audre\AppData\Roaming\npm-cache\_logs\2018-07-07T09_35_19_168Z-debug.log

Please help; thanks a lot!

1 Answers1

0

TL;DR;

just run npm install json-server and you'll be OK.

Explanation

npm scripts

When running a script via npm, node is looking for the command in:

  1. local node_modules/.bin folder (things that are in package.json)
  2. global node_modules/.bin folder (things that you've installed with npm install -g my-package)
  3. your standard shell PATH

your problem

In that case, I guess that the creator of this repo had the json-server package installed, either locally without stating so in package.json or globally.

recommendation

My recommendation is that you run npm install --save json-server and update the package.json file. Actually, I did it already for you: https://github.com/catezee/vodafone/pull/1

ronapelbaum
  • 1,617
  • 14
  • 19