GitHub reactjs 网站的工作流程出错

GitHub workflow for reactjs website giving error

我在 firebase 上托管的 React js 网站的 GitHub 工作流程中遇到错误。当我 运行 在我的终端上部署 firebase 时,它​​会构建并部署该站点,但它不适用于自动部署。

Run npm run build

> tool-frontend@1.0.0 build
> NODE_ENV=production webpack --mode=production

[webpack-cli] Failed to load '/home/runner/work/Tools-Website/Tools-Website/webpack.config.js' config
[webpack-cli] Error: Cannot find module 'html-webpack-plugin'
Require stack:
- /home/runner/work/Tools-Website/Tools-Website/webpack.config.js
- /usr/local/lib/node_modules/webpack-cli/lib/webpack-cli.js
- /usr/local/lib/node_modules/webpack-cli/lib/bootstrap.js
- /usr/local/lib/node_modules/webpack-cli/bin/cli.js
- /usr/local/lib/node_modules/webpack/bin/webpack.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/runner/work/Tools-Website/Tools-Website/webpack.config.js:2:27)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) ***
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/runner/work/Tools-Website/Tools-Website/webpack.config.js',
    '/usr/local/lib/node_modules/webpack-cli/lib/webpack-cli.js',
    '/usr/local/lib/node_modules/webpack-cli/lib/bootstrap.js',
    '/usr/local/lib/node_modules/webpack-cli/bin/cli.js',
    '/usr/local/lib/node_modules/webpack/bin/webpack.js'
  ]
***
Error: Process completed with exit code 2.

当 GitHub 尝试构建存储库时,它找不到“节点模块”,因此出现此错误。因此,为了解决这个问题,您需要在构建之前添加一个中间步骤来执行 npm i