Adarsh Mamgain
Adarsh Mamgain

Reputation: 323

GitHub workflow for reactjs website giving error

I'm getting an error on GitHub workflow for my react js website which is hosted on firebase. When I run firebase deploy on my terminal it builds and deploys the site but it is not working for automatic deploys.

Run npm run build

> [email protected] 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.

Upvotes: 0

Views: 140

Answers (1)

Mayank Agrawal
Mayank Agrawal

Reputation: 86

When GitHub tries to build the repository it cannot find the "node modules" due to which we get this error. Therefore, in order to solve this you need to add an intermediate step to do npm i before you build.

Upvotes: 2

Related Questions