Reputation: 21
When I run:
ng add @spartacus/schematics
I systematically get the error:
Cannot read properties of undefined (reading 'kind')
I am using: Node v18.17.1, CLI 15.0.5 and NPM 9.6.7
I have created the .npmrc file as detailed in the help and in other questions.
Any help getting started as my V4 spartacus is incompatible with the new setup.
thanks
Upvotes: 1
Views: 339
Reputation: 66
If you are using less than 4.7.2 before starting the schematics, it will use the ^4.7.2 rule and install the highest version (4.9.5) which will break other dependencies and cause the schematic to fail.
The solution is to make sure you have 4.7.2 or any version between 4.7.2 and 4.9.0 set as your typescript version before starting the schematic.
Upvotes: 0
Reputation: 66
The schematic kept changing my typescript version to 4.9.5 which was not compatible with other packages. These steps worked to actually run the schematics:
ng update @spartacus/schematics
This fails on the 'kind' problem you encountered, and it changed typescript version to 4.9.5, which is not compatible with Angular 14 and other packages. Change the value for typescript in your package.json back to 4.7.2. Commit.
ng update @spartacus/schematics --from 4.2.0 --to 5.2.0 --migrate-only
This does the code analysis and adds the //TODO:Spartacus comments to your code. This assumes you started at 4.2.0, but the 5.2.0 doesn't match the previous 5.0.0, which seemed to work better without matching. You can update from 5.0.0 to 5.2.0 afterward.
Upvotes: 0
Reputation: 21
In fact not sure that this is normal but I changed the version of typescript:
from
"typescript": "~4.8.2"
to
"typescript": "~4.9.4"
And it now appears to work.
Upvotes: 1