Skip to content

Path[1] argument must be of type string. Received undefined #28109

Closed
@esmayl

Description

@esmayl

Command

extract-i18n

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

I have been trying to export the i18n information from a part of our code, previously this code was in our project as components.
Now I want to create a library out of it and the actual building and using it in the project as a package works but when exporting with ng extract-i18n --project <projectNameHere> I keep getting the error from the title:

An unhandled exception occurred: The "paths[1]" argument must be of type string. Received undefined

In debugging the offending line and file I've found that the actual object used in this process has the path variable but it's an object.

Changing this to an array or just a string does not resolve the issue and even breaks the actual build of the library.

I've reproduced this in a brand new project and still the same error.

Minimal Reproduction

Create a new workspace, add a library and try to extract localization info

  • ng new company.Angular.Components --no-create-application
  • cd .\company.Angular.Components\
  • ng generate library @company/angular-lib-forms
  • ng add @angular/localize
  • ng extract-i18n --project @company/angular-lib-forms

Exception or Error

[error] TypeError [ERR_INVALID_ARG_TYPE]: The "paths[1]" argument must be of type string. Received undefined
    at Object.resolve (node:path:171:9)

    at getCommonConfig (C:\Users\<username>\Desktop\Projects\<projectname>\node_modules\@angular-devkit\build-angular\src\tools\webpack\configs\common.js:275:24)

    at async Promise.all (index 2)

    at async generateWebpackConfig (C:\Users\<username>\Desktop\Projects\<projectname>\node_modules\@angular-devkit\build-angular\src\utils\webpack-browser-config.js:64:22)

    at async generateBrowserWebpackConfigFromContext (C:\Users\<username>\Desktop\Projects\<projectname>\node_modules\@angular-devkit\build-angular\src\utils\webpack-browser-config.js:119:20)

    at async extractMessages (C:\Users\<username>\Desktop\Projects\<projectname>\node_modules\@angular-devkit\build-angular\src\builders\extract-i18n\webpack-extraction.js:52:24)

    at async execute (C:\Users\<username>\Desktop\Projects\<projectname>\node_modules\@angular-devkit\build-angular\src\builders\extract-i18n\builder.js:84:28)

Your Environment

Angular CLI: 18.1.2
Node: 20.15.0
Package Manager: npm 10.7.0
OS: win32 x64

Angular: 18.1.1
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1801.2
@angular-devkit/build-angular   18.1.2
@angular-devkit/core            18.1.2
@angular-devkit/schematics      18.1.2
@angular/cli                    18.1.2
@schematics/angular             18.1.2
ng-packagr                      18.1.0
rxjs                            7.8.1
typescript                      5.5.4
zone.js                         0.14.8

Anything else relevant?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions