我正在设置一个json服务器并安装它,并将其分配为我的npm start命令,如下所示
"scripts": {
"start": "json-server -p 3001 -w db.json"
Run Code Online (Sandbox Code Playgroud)
但是每次我在终端上键入npm start时,都会出现此错误
> api-server@1.0.0 start C:\Work\React-projects\streams\api-server
> json-server -p 3001 -w db.json
'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! api-server@1.0.0 start: `json-server -p 3001 -w db.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the api-server@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There …Run Code Online (Sandbox Code Playgroud)