每当我运行
npx json-server --watch Data/db.json --port 8000
时,它都会抛出错误
TypeError [ERR_PARSE_ARGS_UNKNOWN_OPTION]: Unknown option '--watch'. To specify a positional argument starting with a '-', place it at the end of the command after '--', as in '-- "--watch"
PS C:\Users\dewas\OneDrive\Desktop\Projects\React tutorial\tuts> npx json-server --port 8000 --watch Data/db.json
node:internal/util/parse_args/parse_args:98
throw new ERR_PARSE_ARGS_UNKNOWN_OPTION(
^
TypeError [ERR_PARSE_ARGS_UNKNOWN_OPTION]: Unknown option '--watch'. To specify a positional argument starting with a '-', place it at the end of the command after '--', as in '-- "--watch"
at checkOptionUsage (node:internal/util/parse_args/parse_args:98:11)
at node:internal/util/parse_args/parse_args:360:9
at Array.forEach (<anonymous>)
at parseArgs (node:internal/util/parse_args/parse_args:357:3)
at file:///C:/Users/dewas/OneDrive/Desktop/Projects/React%20tutorial/node_modules/json-server/lib/bin.js:13:33
at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async loadESM (node:internal/process/esm_loader:28:7)
at async handleMainPromise (node:internal/modules/run_main:113:12) {
code: 'ERR_PARSE_ARGS_UNKNOWN_OPTION'
}
来自 json-server 文档
$ npx json-服务器 db.json --端口 8000