1

在 CLI 中运行时出现错误./node_modules/.bin/webpack index.js --mode=development

这是错误:

node:internal/modules/cjs/loader:903
  throw err;
  ^

Error: Cannot find module 'commander'
Require stack:
- /home/jon/.nvm/versions/node/v15.1.0/lib/node_modules/webpack-cli/lib/utils/arg-parser.js
- /home/jon/.nvm/versions/node/v15.1.0/lib/node_modules/webpack-cli/lib/webpack-cli.js
- /home/jon/.nvm/versions/node/v15.1.0/lib/node_modules/webpack-cli/lib/bootstrap.js
- /home/jon/.nvm/versions/node/v15.1.0/lib/node_modules/webpack-cli/bin/cli.js
- /home/jon/Coding/Random/node_modules/webpack/bin/webpack.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:900:15)
    at Function.Module._load (node:internal/modules/cjs/loader:745:27)
    at Module.require (node:internal/modules/cjs/loader:972:19)
    at require (/home/jon/.nvm/versions/node/v15.1.0/lib/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/home/jon/.nvm/versions/node/v15.1.0/lib/node_modules/webpack-cli/lib/utils/arg-parser.js:1:81)
    at Module._compile (/home/jon/.nvm/versions/node/v15.1.0/lib/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
    at Module.load (node:internal/modules/cjs/loader:948:32)
    at Function.Module._load (node:internal/modules/cjs/loader:789:14)
    at Module.require (node:internal/modules/cjs/loader:972:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/jon/.nvm/versions/node/v15.1.0/lib/node_modules/webpack-cli/lib/utils/arg-parser.js',
    '/home/jon/.nvm/versions/node/v15.1.0/lib/node_modules/webpack-cli/lib/webpack-cli.js',
    '/home/jon/.nvm/versions/node/v15.1.0/lib/node_modules/webpack-cli/lib/bootstrap.js',
    '/home/jon/.nvm/versions/node/v15.1.0/lib/node_modules/webpack-cli/bin/cli.js',
    '/home/jon/Coding/Random/node_modules/webpack/bin/webpack.js'
  ]
}

npm commander -v确认我安装了指挥官。我在Linux Mint上并使用nvm安装了npm

我是 npm 新手,所以我不太了解输出。

4

0 回答 0