"Npm Run SJS" 不工作

"Npm Run SJS" Is Not Working

我从 GitHub 分叉了一个项目,我想 运行 命令 npm run sjs,但它给了我一个错误。这就是它所说的:

> 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\_logs18-07-07T09_35_19_168Z-debug.log

请帮忙;非常感谢!

TL;DR;

只需 运行 npm install json-server 就可以了。

说明

npm 脚本

当 运行通过 npm 运行脚本时,节点正在寻找命令:

  1. 本地 node_modules/.bin 文件夹(package.json 中的内容)
  2. 全局 node_modules/.bin 文件夹(您使用 npm install -g my-package 安装的东西)
  3. 你的标准shellPATH

你的问题

在那种情况下,我猜想这个回购协议的创建者已经安装了 json-server 包,要么在本地没有在 package.json 中说明,要么在全球范围内安装。

推荐

我的建议是 运行 npm install --save json-server 并更新 package.json 文件。 实际上,我已经为你做了:https://github.com/catezee/vodafone/pull/1