How do you fix upgrade

2019-08-07 16:42发布

问题:

I'm 3 months new into dart and I've been fairly lucky not to have encountered any issues that couldn't be fixed from answers found on the net, but this one has stumped me.

I downloaded this sample app (https://github.com/vsavkin/angulardart-sample-app) installed it into dart-editor (on my mac mini) using Open Existing Folder and then running get Pub Get (or even Pub Update) on the pubspec.yaml file.

I was getting dartium loading with a running app until I upgraded the SDK from 1.4.2 to 1.5.8 and the pubspec.yaml file from

environment:
sdk: '>=1.4.2 <2.0.0' to

environment:
sdk: '>=1.5.8 <2.0.0'

where everything just broke and i am now getting these types of errors in dartium which I'd like to know how to fix (reverting hasn't helped, 404's are still present - is there some old cache that's being read that I can't find?):

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:63342/aa-app/packages/shadow_dom/shadow_dom.min.js

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:63342/aa-app/web/packages/angular/routing/static_keys.dart An error occurred loading file: package:angular/routing/static_keys.dart package:angular/routing/static_keys.dart:1

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:63342/aa-app/web/packages/angular/cache/module.dart An error occurred loading file: package:angular/cache/module.dart package:angular/cache/module.dart:1

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:63342/aa-app/web/packages/angular/core_dom/directive_injector.dart An error occurred loading file: package:angular/core_dom/directive_injector.dart package:angular/core_dom/directive_injector.dart:1

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:63342/aa-app/web/packages/angular/cache/js_cache_register.dart An error occurred loading file: package:angular/cache/js_cache_register.dart package:angular/cache/js_cache_register.dart:1

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:63342/aa-app/web/packages/angular/directive/static_keys.dart An error occurred loading file: package:angular/directive/static_keys.dart package:angular/directive/static_keys.dart:1

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:63342/aa-app/web/packages/angular/core/static_keys.dart An error occurred loading file: package:angular/core/static_keys.dart package:angular/core/static_keys.dart:1

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:63342/aa-app/web/packages/di/src/reflector.dart An error occurred loading file: package:di/src/reflector.dart package:di/src/reflector.dart:1

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:63342/aa-app/web/packages/angular/change_detection/ast_parser.dart An error occurred loading file: package:angular/change_detection/ast_parser.dart package:angular/change_detection/ast_parser.dart:1

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:63342/aa-app/web/packages/angular/core_dom/compiler_config.dart An error occurred loading file: package:angular/core_dom/compiler_config.dart package:angular/core_dom/compiler_config.dart:1

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:63342/aa-app/web/packages/di/check_bind_args.dart An error occurred loading file: package:di/check_bind_args.dart package:di/check_bind_args.dart:1

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:63342/aa-app/web/packages/di/src/reflector_dynamic.dart An error occurred loading file: package:di/src/reflector_dynamic.dart package:di/src/reflector_dynamic.dart:1

Have tried starting from scratch Have tried different versions of the angular package ie version 11.0, 12.0, 13.0 Have tried different versions of SDK from 1.4.2 to 1.5.3 to 1.5.8 still the same output

What on earth have i done to ruin something that was working so slickly?

回答1:

The error "Module.DEFAULT_REFLECTOR not initialized" is thrown because the di transformer is not executed.

You need to add the anfular transformer to your pubspec.yaml (which includes the di transformer)