angular: Error: Argument at index 2 of UMD factory call is not a `require` call with a single string argument

Which @angular/* package(s) are the source of the bug?

compiler, upgrade

Is this a regression?

Yes

Description

Hi Team, After upgrade our existing project from angular 12 to 13, It starting throwing error and stucked at generating browser application bundle phase. Please find the error below:

Error: Argument at index 2 of UMD factory call is not a `require` call with a single string argument:
factory(require('@angular/core'),require('@angular/common'),exports, require('@angular/core'), require('perfect-scrollbar'), require('rxjs'), require('rxjs/operators'), require('@angular/common'))
    at getRequiredModulePath (file:///***/node_modules/@angular/compiler-cli/bundles/ngcc/main-ngcc.js:3627:11)
    at getImportsOfUmdModule (file:///***/node_modules/@angular/compiler-cli/bundles/ngcc/main-ngcc.js:3618:15)
    at UmdDependencyHost.extractImports (file:///***/node_modules/@angular/compiler-cli/bundles/ngcc/main-ngcc.js:4085:37)
    at UmdDependencyHost.recursivelyCollectDependencies (file:///***/node_modules/@angular/compiler-cli/bundles/ngcc/main-ngcc.js:1459:26)
    at UmdDependencyHost.collectDependencies (file:///***/node_modules/@angular/compiler-cli/bundles/ngcc/main-ngcc.js:1445:12)
    at DependencyResolver.getEntryPointWithDependencies (file:///***/node_modules/@angular/compiler-cli/bundles/ngcc/main-ngcc.js:3833:12)
    at EntryPointCollector.walkDirectoryForPackages (file:///***/node_modules/@angular/compiler-cli/bundles/ngcc/main-ngcc.js:4403:40)
    at EntryPointCollector.walkDirectoryForPackages (file:///***/node_modules/@angular/compiler-cli/bundles/ngcc/main-ngcc.js:4423:32)
    at file:///***/node_modules/@angular/compiler-cli/bundles/ngcc/main-ngcc.js:4557:70
    at trackDuration (file:///***/node_modules/@angular/compiler-cli/bundles/ngcc/main-ngcc.js:4154:18)
(node:12620) UnhandledPromiseRejectionWarning: Error: NGCC failed.
    at NgccProcessor.process (***\node_modules\@ngtools\webpack\src\ngcc_processor.js:146:19)
    at ***\node_modules\@ngtools\webpack\src\ivy\plugin.js:141:27
    at Hook.eval [as call] (eval at create (***\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:24:1)
    at Hook.CALL_DELEGATE [as _call] (***\node_modules\tapable\lib\Hook.js:14:14)
    at Compiler.newCompilation (***\node_modules\webpack\lib\Compiler.js:1054:30)
    at ***\node_modules\webpack\lib\Compiler.js:1099:29
    at eval (eval at create (***\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:31:1)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:12620) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:12620) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

No response

Anything else?

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 29 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Likely in this week’s release, on Wednesday/Thursday.

I tried to revert my angular packages from v12.2.14 back to v12.2.13 in my nx repo and can confirm that the error is gone.

Likely in this week’s release, on Wednesday/Thursday.

Hey, is this fix now available? If yes, it would be under which minor version of v12?

So @gkalpak if I understand it correctly if I revert back to angular v12.2.13 as a fixed version for the moment in my package.Json file of my nx repo which was using v12.2.14, I will not have this issue anymore while building?

Happened to me as well when I tried to upgrade from Angular 11 to Angular 12. Is there any solution for Angular 12?

@StevRoger: The fix has been backported to the v12.2.x branch and will be included in the next v12 release, but I am not sure when the release will be.

In the meantime, you could try downgrading to 12.2.13.