angulardart / angular

Fast and productive web framework provided by Dart
https://pub.dev/packages/angular
MIT License
1.83k stars 232 forks source link

NoSuchMethodError: Class 'CompilerFlags' has no instance getter 'useNewPreserveWhitespace'. #1393

Closed chstrong closed 6 years ago

chstrong commented 6 years ago

General Details

MacOS: 10.13.4 (High Sierra) Dart Version: 2.0.0-dev.60.0 Quickstart URL: https://github.com/angular-examples/quickstart Using command line, not Webstorm

pubspec.yaml:

name: angular_app
description: A web app that uses AngularDart
version: 0.0.1

environment:
  sdk: '>=2.0.0-dev.56.0 <2.0.0'

dependencies:
  angular: ^5.0.0-alpha

dev_dependencies:
  angular_test: ^2.0.0-alpha
  build_runner: ^0.8.8
  build_test: ^0.10.2
  build_web_compilers: ^0.4.0
  test: ^0.12.30

Commands

git clone https://github.com/angular-examples/quickstart cd quickstart pub get webdev serve

Output pub get

charms:quickstart$ pub get Resolving dependencies... (26.4s) Overriding the upper bound Dart SDK constraint to <=2.0.0-dev.60.0 for the following packages:

args, boolean_selector, charcode, cli_util, convert, dart_style, fixnum, front_end, glob, graphs, http, http_parser, intl, io, isolate, js, kernel, logging, meta, multi_server_socket, node_preamble, package_config, plugin, pub_semver, quiver, quiver_hashcode, shelf_packages_handler, source_map_stack_trace, source_maps, source_span, stack_trace, string_scanner, term_glyph, tuple, typed_data

To disable this you can set the PUB_ALLOW_PRERELEASE_SDK system environment variable to false, or you can silence this message by setting it to quiet.

Output Webdev Serve

charms:quickstart$ webdev serve [INFO] Setting up file watchers completed, took 41ms [INFO] Waiting for all file watchers to be ready completed, took 192ms [INFO] Building new asset graph completed, took 1.4s [INFO] Checking for unexpected pre-existing outputs. completed, took 2ms [SEVERE] angular on lib/app_component.dart: Unhandled exception in the AngularDart compiler!

Please report a bug: https://github.com/dart-lang/angular/issues/new NoSuchMethodError: Class 'CompilerFlags' has no instance getter 'useNewPreserveWhitespace'. Receiver: Instance of 'CompilerFlags' Tried calling: useNewPreserveWhitespace [SEVERE] build_web_compilers|entrypoint on web/main.dart: Unable to find modules for some sources, this is usually the result of either a bad import, a missing dependency in a package (or possibly a dev_dependency needs to move to a real dependency), or a build failure (if importing a generated file).

Please check the following imports:

import 'package:angular_app/app_component.template.dart' as ng; from angular_app|web/main.dart at 2:1

[SEVERE] build_web_compilers|entrypoint on test/app_test.dart: Unable to find modules for some sources, this is usually the result of either a bad import, a missing dependency in a package (or possibly a dev_dependency needs to move to a real dependency), or a build failure (if importing a generated file).

Please check the following imports:

import 'package:angular_app/app_component.template.dart' as ng; from angular_app|test/app_test.dart at 4:1

[SEVERE] build_web_compilers|entrypoint on test/app_test.dart.browser_test.dart: Unable to find modules for some sources, this is usually the result of either a bad import, a missing dependency in a package (or possibly a dev_dependency needs to move to a real dependency), or a build failure (if importing a generated file).

Please check the following imports:

import 'package:angular_app/app_component.template.dart' as ng; from angular_app|test/app_test.dart at 4:1

[INFO] Running build completed, took 17.8s [INFO] Caching finalized dependency graph completed, took 295ms [INFO] Succeeded after 18.1s with 402 outputs (2420 actions) Serving web on http://localhost:8080 Serving test on http://localhost:8081

Output webdev serve second attempt (no error)

charms:quickstart$ webdev serve [INFO] Setting up file watchers completed, took 44ms [INFO] Waiting for all file watchers to be ready completed, took 191ms [INFO] Reading cached asset graph completed, took 449ms [INFO] Checking for updates since last build completed, took 755ms [INFO] Running build completed, took 239ms [INFO] Caching finalized dependency graph completed, took 204ms [INFO] Succeeded after 455ms with 0 outputs (0 actions) Serving web on http://localhost:8080 Serving test on http://localhost:8081

Browser result on http://localhost:8080 - runs no further than "Loading..."

Loading...

leonsenft commented 6 years ago

We had a version constraint issue in an older version of Angular.

https://github.com/dart-lang/angular/issues/1330 https://github.com/dart-lang/angular/issues/1343

Notice your Angular isn't up-to-date

angular 5.0.0-alpha+11 (5.0.0-alpha+14 available)

Please run pub upgrade and try again; that should fix the issue. Feel free to reopen if it doesn't!

chstrong commented 6 years ago

Tried pub upgrade within the existing project, and also in a new one. Nothing changed. Below is the output. I assume when running "pub upgrade", or "pub get" it should fetch the newest versions?

charms:quickstart$ pub upgrade Resolving dependencies... (15.4s) Overriding the upper bound Dart SDK constraint to <=2.0.0-dev.60.0 for the following packages:

args, boolean_selector, charcode, cli_util, convert, dart_style, fixnum, front_end, glob, graphs, http, http_parser, intl, io, isolate, js, kernel, logging, meta, multi_server_socket, node_preamble, package_config, plugin, pub_semver, quiver, quiver_hashcode, shelf_packages_handler, source_map_stack_trace, source_maps, source_span, stack_trace, string_scanner, term_glyph, tuple, typed_data

To disable this you can set the PUB_ALLOW_PRERELEASE_SDK system environment variable to false, or you can silence this message by setting it to quiet. analyzer 0.31.1 (0.32.1 available) angular 5.0.0-alpha+11 (5.0.0-alpha+14 available) angular_ast 0.5.3+2 angular_compiler 0.4.0-alpha+14 angular_test 2.0.0-alpha+9 (2.0.0-alpha+12 available) archive 2.0.0 args 1.4.3 async 2.0.7 bazel_worker 0.1.10 boolean_selector 1.0.3 build 0.12.6 build_config 0.3.0 build_modules 0.2.2+6 build_resolvers 0.2.0+2 build_runner 0.8.10 build_runner_core 0.1.0 build_test 0.10.2+4 build_web_compilers 0.4.0+4 built_collection 3.1.1 built_value 5.5.1 charcode 1.1.1 cli_util 0.1.3 code_builder 3.1.0 collection 1.14.9 convert 2.0.1 crypto 2.0.3 csslib 0.14.4 dart_style 1.0.9+1 (1.0.14 available) fixnum 0.10.7 front_end 0.1.0-alpha.9 (0.1.1 available) glob 1.1.5 graphs 0.1.2 html 0.13.3+1 http 0.11.3+16 http_multi_server 2.0.5 http_parser 3.1.2 intl 0.15.6 io 0.3.2+1 isolate 1.1.0 (2.0.1 available) js 0.6.1 json_annotation 0.2.8 kernel 0.3.0-alpha.9 (0.3.1 available) logging 0.11.3+1 matcher 0.12.2+1 meta 1.1.5 mime 0.9.6+1 multi_server_socket 1.0.1 node_preamble 1.4.2 package_config 1.0.3 package_resolver 1.0.3 path 1.6.0 plugin 0.2.0+2 pool 1.3.5 protobuf 0.8.0 (0.9.0 available) pub_semver 1.4.1 pubspec_parse 0.1.1 quiver 0.29.0+1 quiver_hashcode 1.0.0 scratch_space 0.0.2+1 shelf 0.7.3+1 shelf_packages_handler 1.0.3 shelf_static 0.2.7+1 shelf_web_socket 0.2.2+2 source_gen 0.8.1+3 source_map_stack_trace 1.1.4 source_maps 0.10.5 source_span 1.4.0 stack_trace 1.9.2 stream_channel 1.6.7 stream_transform 0.0.13 string_scanner 1.0.2 term_glyph 1.0.0 test 0.12.40 tuple 1.0.1 typed_data 1.1.5 utf 0.9.0+4 watcher 0.9.7+8 web_socket_channel 1.0.8 yaml 2.1.14 No dependencies changed.

Also quite strange:

charms:quickstart$ pub upgrade angular

Resolving dependencies... 
Because angular_app depends on angular <4.0.0+2 or >4.0.0+2 but the latest version
  (4.0.0+2) is required, version solving failed.
denniskaselow commented 6 years ago

I've run into the same issue. Explicitly setting

angular: ^5.0.0-alpha+14

helps, but it'll downgrade some other dependencies:

< build_config 0.2.6+2 (was 0.3.0) (0.3.0 available)
< build_runner 0.8.9 (was 0.8.10) (0.8.10 available)

Setting build_runner to 0.8.10 will not work:

Because build_runner >=0.8.10 depends on build_config ^0.3.0 and angular >=5.0.0-alpha+12 depends on build_config ^0.2.6, build_runner >=0.8.10 is incompatible with angular >=5.0.0-alpha+12.
chstrong commented 6 years ago

Thanks. I'll try that. But shouldn't this be a bug that needs solving? When reading through the pub documentation, it says, that the newest dependencies from the major versions should be fetched with "pub get" or "pub upgrade". But this doesn't seem to be the case right now.

nailgilaziev commented 6 years ago

I met this issue too by following guide https://webdev-dartlang-org-dev.firebaseapp.com/angular/tutorial/toh-pt0

denniskaselow commented 6 years ago

It was fixed in https://github.com/dart-lang/angular/commit/10eb6daab3eef16766b8552fb157d022e79ac593 but probably after 5.0.0-alpha+14 was published.

chalin commented 6 years ago

Once angular_components +14 is released, I'll set the minimal version of angular to 5.0.0-alpha+14 in the sample apps. That'll help avoid reoccurrences of this issue. /cc @kwalrath

chalin commented 6 years ago

I don't know when angular_components +14 will be released, so in the meantime, I've updated all example apps to have +13 as the minimal version.