1
votes

While following tutorail - Angular-dart tutorial - Tour of Heroes - part 2

with using IntelliJ IDEA in Windows 10 while using chrome, I got following error(s) -

[SEVERE] build_web_compilers|entrypoint on web/main.dart (cached): 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.css.shim.dart' as import0; from angular_app|lib/app_component.template.dart at 12:1

[SEVERE] Failed after 1.3s Serving web on http://localhost:53323

I have checked multiple times & I have replaced all - 5 files - namely lib/app_component.css, lib/app_component.dart, lib/app_component.html, lib/src/hero.dart & lib/src/mock_heroes.dart from Review the app structure but I am still getting the above mentioned error & -

  1. I could not find any app_component.template.dart

  2. Nor could found any instance of imported package:angular_app/app_component.css.shim.dart or shim using IntelliJ Find in Path (Ctrl+Shift+F)

  3. I have tried to delete build and rebuild.

  4. I have also re-installed dart 2.1.0 using windows package manager & changed the location of dart-sdk accordingly in IntelliJ IDEA Settings/Dart, as for brief period I was getting dart-sdk error, but that is fixed.


This my first time asking question on stacksoverflow, but I have checked similar questions, could not resolve that issue.

2

2 Answers

0
votes

the most likely reason for that build failure is due to the stylesUrls files not being found. This could be because the name in that array doesn't match the name in the file system or is not the expected place in the file system.

To confirm, I started from scratch, downloaded the quickstart-master.zip to get the project structure. And followed the steps all the way through the step you were stuck on. The only time I was able to generate that error while following the steps is when I added thestyleUrls: ['app_component.css'], to app_component.dart prior to creating the file.

I got the same:

[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_components.css.shim.dart' as import0; from angular_app|lib/app_component.template.dart at 12:1

Once i created the css file, the error went away and everything worked fine. I completed the entire step you were up to and my app was working fine. I then did as you did and copied each file from the step and replaced my work with it, still worked. So confirm my hunch, i changed the name of the css file, and received the same error.

regarding app_component.template.dart that file is auto generated by dart and can be found in your project under .dart_tool/build/generated/angular_app/lib

0
votes

I had a very similar problem. I ran webdev build and then webdev serve and it fixed it right up.