运行 npx json-server --watch Data/db.json --port 8000 时,它会抛出一个新错误

问题描述 投票:0回答:1

每当我运行

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
1个回答
0
投票

来自 json-server 文档

$ npx json-服务器 db.json --端口 8000

© www.soinside.com 2019 - 2024. All rights reserved.