Closed Marco-Bronner closed 9 months ago
After a lot of search I found the following:
In ast-utils.js line 415:29 a moduleSpecifier is handed over to the typescript library and its isStringLiteral method. It seems as if this file (a pipe) is missing this moduleSpecifier.
SafePipe, that is responsible for the error:
import { Pipe, PipeTransform } from '@angular/core'; import { DomSanitizer, SafeHtml, SafeStyle, SafeScript, SafeUrl, SafeResourceUrl } from '@angular/platform-browser';
@Pipe({ name: 'safe' }) export class SafePipe implements PipeTransform {
constructor(protected sanitizer: DomSanitizer) {}
public transform(value: any, type: string): SafeHtml | SafeStyle | SafeScript | SafeUrl | SafeResourceUrl {
switch (type) {
case 'html': return this.sanitizer.bypassSecurityTrustHtml(value);
case 'style': return this.sanitizer.bypassSecurityTrustStyle(value);
case 'script': return this.sanitizer.bypassSecurityTrustScript(value);
case 'url': return this.sanitizer.bypassSecurityTrustUrl(value);
case 'resourceUrl': return this.sanitizer.bypassSecurityTrustResourceUrl(value);
default: throw new Error(Invalid safe type specified: ${type}
);
}
}
}
This pipe is imported and declared in app.module.ts, so nothing special. Anyone has an idea why this file might cause this?
@Marco-Bronner This error comes from incorrect dependency versions. Try checking which devDependecies weren't updated during the upgrade, e.g. "@angular-devkit/build-angular". In addition, if there was a warning about missing dependencies, try to add them too.
@kpawelczak I cannot confirm this suggestion. The upgrade is running if I remove some components. And these components do not introduce new dependencies. I have not figured out the root cause. However I upgraded with some components removed and added them back manually afterwards. This approach is working. Therefore I am closing this topic, thanks for trying.
Describe the bug Having a spartacus 4.x version with angular (core+cli) updated to version 14 running ng update @spartacus/schematics@5.0.0 fails in Comment about usage of removed public methods or properties. ✖ Migration failed: Cannot read property 'kind' of undefined See "/private/var/folders/vd/ywj9wt4d331c2r7hrvx7q2qc0000gn/T/ng-54qK6b/angular-errors.log" for further details.
angular-errors.log: [error] TypeError: Cannot read property 'kind' of undefined at Object.isStringLiteral ([path_I_removed]/node_modules/@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.js:29040:21) at [path_I_removed]/node_modules/@schematics/angular/utility/ast-utils.js:415:29 at Array.filter ()
at isImported ([path_I_removed]/node_modules/@schematics/angular/utility/ast-utils.js:415:10)
at migrateMethodPropertiesDeprecation ([path_I_removed]/node_modules/@spartacus/schematics/src/migrations/mechanism/methods-and-properties-deprecations/methods-and-properties-deprecations.js:21:44)
at [path_I_removed]/node_modules/@spartacus/schematics/src/migrations/5_0/methods-and-properties-deprecations/methods-and-properties-deprecations.js:14:93
at callRuleAsync (/private/var/folders/vd/ywj9wt4d331c2r7hrvx7q2qc0000gn/T/angular-cli-packages-b74y7B/node_modules/@angular-devkit/schematics/src/rules/call.js:78:24)
at /private/var/folders/vd/ywj9wt4d331c2r7hrvx7q2qc0000gn/T/angular-cli-packages-b74y7B/node_modules/@angular-devkit/schematics/src/rules/call.js:73:40
at Observable._subscribe (/private/var/folders/vd/ywj9wt4d331c2r7hrvx7q2qc0000gn/T/angular-cli-packages-b74y7B/node_modules/rxjs/internal/observable/defer.js:10:21)
at Observable._trySubscribe (/private/var/folders/vd/ywj9wt4d331c2r7hrvx7q2qc0000gn/T/angular-cli-packages-b74y7B/node_modules/rxjs/internal/Observable.js:44:25)
Tell us the version of Spartacus 4.x to 5.0.0
To Reproduce Steps to reproduce the behavior:
(generally following the migration steps as provided in: https://help.sap.com/docs/SAP_COMMERCE_COMPOSABLE_STOREFRONT/10a8bc7f635b4e3db6f6bb7880e58a7d/7266f6f01edb4328b4e09df299ea09be.html?locale=en-US&version=5.0#loiof1117dc1ee2c4bdb98ebb362b06995f6)
Expected behavior code is commented properly
Desktop (please complete the following information):
Additional context I was doing the migration steps before and it was working. Can I copy the changed into the current branch and move on manually?