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

Bug(transloco): Cannot read properties of undefined (reading 'sourceRoot') #805

Open
1 task done
saeidi-dev opened this issue Oct 6, 2024 · 5 comments
Open
1 task done

Comments

@saeidi-dev
Copy link

saeidi-dev commented Oct 6, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Which Transloco package(s) are the source of the bug?

Transloco

Is this a regression?

Yes

Current behavior

When installing in nx, I encounter the following error, first I install the package, then the add command.

I use monorepo, there are several libs in the packages directory, I want to install transloco in lib i18n

  1. npm i @jsverse/transloco
  2. nx g @jsverse/transloco:ng-add
nx g @jsverse/transloco:ng-add

 NX  Generating @jsverse/transloco:ng-add

√ 🌍 Which languages do you need? · en, es
√ 🚀 Are you working with server side rendering? (y/N) · false
TypeError: Cannot read properties of undefined (reading 'sourceRoot')
    at C:\Users\Saeidi\source\ng-simorgh\node_modules\@jsverse\transloco\schematics\src\ng-add\index.js:38:36
    at callRuleAsync (C:\Users\Saeidi\source\ng-simorgh\node_modules\@angular-devkit\schematics\src\rules\call.js:77:24)
    at C:\Users\Saeidi\source\ng-simorgh\node_modules\@angular-devkit\schematics\src\rules\call.js:73:40
    at Observable._subscribe (C:\Users\Saeidi\source\ng-simorgh\node_modules\rxjs\dist\cjs\internal\observable\defer.js:8:31)
    at Observable._trySubscribe (C:\Users\Saeidi\source\ng-simorgh\node_modules\rxjs\dist\cjs\internal\Observable.js:41:25)
    at C:\Users\Saeidi\source\ng-simorgh\node_modules\rxjs\dist\cjs\internal\Observable.js:35:31
    at Object.errorContext (C:\Users\Saeidi\source\ng-simorgh\node_modules\rxjs\dist\cjs\internal\util\errorContext.js:22:9)
    at Observable.subscribe (C:\Users\Saeidi\source\ng-simorgh\node_modules\rxjs\dist\cjs\internal\Observable.js:26:24)
    at C:\Users\Saeidi\source\ng-simorgh\node_modules\rxjs\dist\cjs\internal\operators\map.js:9:16
    at OperatorSubscriber.<anonymous> (C:\Users\Saeidi\source\ng-simorgh\node_modules\rxjs\dist\cjs\internal\util\lift.js:14:28)

 NX   Cannot read properties of undefined (reading 'sourceRoot')

Pass --verbose to see the stacktrace.

Expected behavior

Installation works

Please provide a link to a minimal reproduction of the bug, if you won't provide a link the issue won't be handled.

https://codesandbox.io/s/ngneat-transloco-kn52hs

Transloco Config

No response

Please provide the environment you discovered this bug in

Transloco: ^7.5.0
Angular: ~18.2.0
Node: v22.5.1
Package Manager: npm
OS: Windows

Browser

No response

Additional context

No response

I would like to make a pull request for this bug

Yes 🚀

@shaharkazaz
Copy link
Collaborator

@saeidi-dev Hey 🙂
How is the link you added reproducing the issue? Please add a reproduction repo. You are welcome to open a PR for the fix but I need to understand the scenario where this is happening 👍

@saeidi-dev
Copy link
Author

I use monorepo, there are several libs in the packages directory, I want to install transloco in lib i18n
@shaharkazaz

@shaharkazaz
Copy link
Collaborator

@saeidi-dev did you try specifiying the project?

@saeidi-dev
Copy link
Author

nx structure

apps
    -myapp
packages
    -i18n // is lib
    

command:

nx g @jsverse/transloco:ng-add --project=i18n

@shaharkazaz
Copy link
Collaborator

@saeidi-dev Instead of describing the project, can you please create a reproduction repo? you are using nx this should take under 5 minutes to mimic your issue. This is important for debugging and reviewing the solution you want to make in your PR (if you wish to make one).

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

No branches or pull requests

2 participants