Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An unhandled exception occurred: Cannot find module 'webpack' #689

Closed
ItsMeRomian opened this issue Apr 28, 2022 · 4 comments
Closed

An unhandled exception occurred: Cannot find module 'webpack' #689

ItsMeRomian opened this issue Apr 28, 2022 · 4 comments
Labels

Comments

@ItsMeRomian
Copy link

Hi!
When trying to build a web version on azure Pipelines, we're getting the following error:

An unhandled exception occurred: Cannot find module 'webpack'
Require stack:
- /home/vsts/work/1/s/node_modules/@angular-devkit/build-webpack/src/webpack/index.js
- /home/vsts/work/1/s/node_modules/@angular-devkit/build-webpack/src/index.js
- /home/vsts/work/1/s/node_modules/@angular-devkit/build-angular/src/builders/browser/index.js
- /home/vsts/work/1/s/node_modules/@angular-devkit/build-angular/src/index.js
- /home/vsts/work/1/s/node_modules/@angular-builders/custom-webpack/dist/browser/index.js
- /home/vsts/work/1/s/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js
- /home/vsts/work/1/s/node_modules/@angular-devkit/architect/node/index.js
- /home/vsts/work/1/s/node_modules/@angular/cli/models/architect-command.js
- /home/vsts/work/1/s/node_modules/@angular/cli/commands/build-impl.js
- /home/vsts/work/1/s/node_modules/@angular-devkit/schematics/tools/export-ref.js
- /home/vsts/work/1/s/node_modules/@angular-devkit/schematics/tools/index.js
- /home/vsts/work/1/s/node_modules/@angular/cli/utilities/json-schema.js
- /home/vsts/work/1/s/node_modules/@angular/cli/models/command-runner.js
- /home/vsts/work/1/s/node_modules/@angular/cli/lib/cli/index.js
- /home/vsts/work/1/s/node_modules/@angular/cli/lib/init.js

The commands we're doing to build the angular app:

npm install -g @angular/cli 
npm install
npm run web:build

If we add npm install webpack webpack-cli --save-dev before we do the build, it succeeds to build, but the generated page is blank and in the console we see the following error:

polyfills.js:1 Uncaught ReferenceError: global is not defined

Are we doing something wrong?

@stale
Copy link

stale bot commented Jun 12, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 12, 2022
@DwGoing
Copy link

DwGoing commented Aug 8, 2022

@ItsMeRomian hi bro, Do you have found a solution? I got the same problem.

@ItsMeRomian
Copy link
Author

@DwGoing ive removed all packages ive added on my own, grabbed the package.json from this repo and removed node_modules & package-lock.json and did a clean install. that fixed it.

@vunb
Copy link

vunb commented Sep 20, 2022

I resolved problem by install the latest webpack.

npm install --save-dev webpack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants