0

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

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: []
}
4

1 回答 1

0

我通过全局安装修复了它--force

npm install -g live-server --force
于 2021-10-12T13:30:31.480 回答