npm live 服务器无法在本地运行 windows os

npm live server not working on local windows os

我使用这个命令全局安装了实时服务器:

npm install -g live-server

但是当我 运行 live-server public/index.html 它不工作时显示以下错误:

internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module 'C:\Users\sabbi\AppData\Roaming\npm\node_modules\live-server\live-server.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

我通过 --force:

全局安装修复了它
npm install -g live-server --force