refi64 / vuedart

Create Vue web apps in Dart
https://refi64.com/vuedart
310 stars 19 forks source link

Webdev serve error on tutorial #41

Closed dko1905 closed 5 years ago

dko1905 commented 5 years ago

Hello I am new to this and trying out the tutorials.

I get an error when using the code from the first tutorial.

//index.dart
import 'package:vue/vue.dart';
@VueApp(el: '#app')
class App extends VueAppBase {
}
App app;
void main() {
  app = App();
  app.create();
}
<!DOCTYPE html>

<head>
  <title>VueDart first example</title>

  <script src="https://unpkg.com/vue"></script>

  <script defer src="index.vue.dart.js"></script>
  <script defer src="packages/browser/dart.js"></script>
</head>

<body vuedart>
  <div id="app">
    <p>My first Vue app!</p>
  </div>
</body>
}

When I use "webdev serve" command in the terminal, it builds successfully but then print the error:

[INFO] Serving `web` on http://localhost:8080
[INFO] Running build completed, took 262ms
[INFO] Caching finalized dependency graph completed, took 161ms
[SEVERE] vue:vue on web/index.dart (cached):
[SEVERE] Failed after 437ms

I hope you can help.

refi64 commented 5 years ago

Can you try running webdev serve -v?

dko1905 commented 5 years ago

Here is my output

$ webdev serve -v
[INFO] Connecting to the build daemon...
[INFO] Generating build script...
[INFO] Generating build script completed, took 317ms
[INFO] 
[INFO] Starting daemon...
[INFO] BuildDefinition: Initializing inputs
[INFO] 
[INFO] BuildDefinition: Reading cached asset graph...
[INFO] 
[INFO] BuildDefinition: Reading cached asset graph completed, took 244ms
[INFO] 
[INFO] 
[INFO] BuildDefinition: Checking for updates since last build...
[INFO] 
[INFO] BuildDefinition: Checking for updates since last build completed, took 787ms
[INFO] 
[INFO] 
[INFO] BuildDefinition: Initializing inputs
[INFO] BuildDefinition: Reading cached asset graph...
[INFO] BuildDefinition: Reading cached asset graph completed, took 244ms
[INFO] 
[INFO] BuildDefinition: Checking for updates since last build...
[INFO] BuildDefinition: Checking for updates since last build completed, took 787ms
[INFO] 
[INFO] build_runner: Setting up file watchers...
[INFO] build_runner: Setting up file watchers completed, took 2ms
[INFO] 
[INFO] Registering build targets...
[INFO] Starting initial build...
[INFO] Starting resource servers...
[INFO] Serving `web` on http://localhost:8080

[INFO] About to build [web]...
[INFO] Build: Running build...
[INFO] Build: Running build completed, took 790ms

[INFO] Build: Caching finalized dependency graph...
[INFO] Build: Caching finalized dependency graph completed, took 140ms

[SEVERE] vue:vue on web/index.dart (cached): 
[SEVERE] Build: Failed after 942ms

If I delete the cache it looks like this:

$ webdev serve -v
[INFO] Connecting to the build daemon...
[INFO] Generating build script...
[INFO] Generating build script completed, took 346ms
[INFO] 
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 13.1s
[INFO] 
[INFO] Starting daemon...
[INFO] BuildDefinition: Initializing inputs
[INFO] 
[INFO] BuildDefinition: Building new asset graph...
[INFO] 
[INFO] BuildDefinition: Building new asset graph completed, took 1.3s
[INFO] 
[INFO] 
[INFO] BuildDefinition: Checking for unexpected pre-existing outputs....
[INFO] 
[INFO] BuildDefinition: Checking for unexpected pre-existing outputs. completed, took 1ms
[INFO] 
[INFO] 
[INFO] BuildDefinition: Initializing inputs
[INFO] BuildDefinition: Building new asset graph...
[INFO] BuildDefinition: Building new asset graph completed, took 1.3s
[INFO] 
[INFO] BuildDefinition: Checking for unexpected pre-existing outputs....
[INFO] BuildDefinition: Checking for unexpected pre-existing outputs. completed, took 1ms
[INFO] 
[INFO] build_runner: Setting up file watchers...
[INFO] build_runner: Setting up file watchers completed, took 2ms
[INFO] 
[INFO] Registering build targets...
[INFO] Starting initial build...
[INFO] Starting resource servers...
[INFO] Serving `web` on http://localhost:8080

[INFO] About to build [web]...
[INFO] Build: Running build...
[SEVERE] vue:vue on web/index.dart: 
[INFO] Heartbeat: 2.5s elapsed, 538/552 actions completed.
[INFO] Heartbeat: 3.6s elapsed, 1173/1177 actions completed.
[INFO] Heartbeat: 4.7s elapsed, 1259/1283 actions completed.
[INFO] Heartbeat: 5.7s elapsed, 1268/1283 actions completed.
[INFO] Heartbeat: 6.8s elapsed, 3584/3584 actions completed.
[INFO] Build: Running build completed, took 6.9s

[INFO] Build: Caching finalized dependency graph...
[INFO] Build: Caching finalized dependency graph completed, took 170ms

[SEVERE] Build: Failed after 7.0s
refi64 commented 5 years ago

Err it's not showing an actual error, that's odd... I'll have to try this myself later.

dko1905 commented 5 years ago

I hope you fix it.

Yonghang commented 5 years ago

when I run webdev serve -v, then it prints

[INFO] Connecting to the build daemon...
[INFO] Generating build script...
[INFO] Generating build script completed, took 819ms
[INFO] 
[INFO] Starting daemon...
[INFO]BuildDefinition: Initializing inputs
[INFO]BuildDefinition: Reading cached asset graph...
[INFO]BuildDefinition: Reading cached asset graph completed, took 612ms

[INFO]BuildDefinition: Checking for updates since last build...
[INFO]BuildDefinition: Checking for updates since last build completed, took 1.6s

[INFO] Initializing inputs
[INFO] Reading cached asset graph...
[INFO] Reading cached asset graph completed, took 612ms
[INFO] 
[INFO] Checking for updates since last build...
[INFO] Checking for updates since last build completed, took 1.6s
[INFO] 
[INFO] Setting up file watchers...
[INFO] Setting up file watchers completed, took 6ms
[INFO] 
[INFO] Registering build targets...
[INFO] Starting initial build...
[INFO] Starting resource servers...
[INFO] Serving `web` on http://127.0.0.1:8080

[INFO] About to build [web]...
[INFO]Build: Running build...
[INFO]Build: Running build completed, took 594ms

[INFO]Build: Caching finalized dependency graph...
[INFO]Build: Caching finalized dependency graph completed, took 261ms

[SEVERE]vue:vue on web/index.dart (cached): NoSuchMethodError: Class 'RestrictedAnalysisContext' has no instance method 'resolveCompilationUnit' with matching arguments.
Receiver: Instance of 'RestrictedAnalysisContext'
Tried calling: resolveCompilationUnit(Instance of 'FileSource', Instance of 'LibraryElementImpl')
Found: resolveCompilationUnit(Source, LibraryElement) => CompilationUnit
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:50:5)
#1      RestrictedAnalysisContext.noSuchMethod (package:analyzer/src/dart/analysis/restricted_analysis_context.dart:53:18)
#2      RestrictedAnalysisContext.resolveCompilationUnit (package:analyzer/src/context/context.dart:538:19)
#3      ElementImpl.unit (package:analyzer/src/dart/element/element.dart:3501:39)
#4      VuedartBuildContext.getVueClassesIter.<anonymous closure> (package:vue/builders.dart:200:37)
#5      ExpandIterator.moveNext (dart:_internal/iterable.dart:481:29)
#6      WhereIterator.moveNext (dart:_internal/iterable.dart:438:22)
#7      Iterable.isEmpty (dart:core/iterable.dart:434:33)
#8      MappedIterable.isEmpty (dart:_internal/iterable.dart:368:33)
#9      Iterable.isNotEmpty (dart:core/iterable.dart:441:27)
#10     VuedartBuildContext.doesUriHaveVueClasses (package:vue/builders.dart:523:47)
#11     WhereIterator.moveNext (dart:_internal/iterable.dart:439:11)
#12     VuedartBuildContext.rewriteVueImportUris (package:vue/builders.dart:536:54)
#13     VuedartBuildContext.build (package:vue/builders.dart:571:28)
<asynchronous suspension>
#14     _VuedartBuilder.build (package:vue/builders.dart:604:62)
<asynchronous suspension>
#15     runBuilder.buildForInput (package:build/src/generate/run_builder.dart:45:21)
<asynchronous suspension>
#16     MappedListIterable.elementAt (dart:_internal/iterable.dart:414:29)
#17     ListIterator.moveNext (dart:_internal/iterable.dart:343:26)
#18     Future.wait (dart:async/future.dart:393:26)
#19     runBuilder.<anonymous closure> (package:build/src/generate/run_builder.dart:51:36)
#20     _rootRun (dart:async/zone.dart:1124:13)
#21     _CustomZone.run (dart:async/zone.dart:1021:19)
#22     _runZoned (dart:async/zone.dart:1516:10)
#23     runZoned (dart:async/zone.dart:1500:12)
#24     scopeLogAsync (package:build/src/builder/logging.dart:22:3)
#25     runBuilder (package:build/src/generate/run_builder.dart:51:9)
<asynchronous suspension>
#26     _SingleBuild._runForInput.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:build_runner_core/src/generate/build_impl.dart:467:19)
#27     _NoOpBuilderActionTracker.trackStage (package:build_runner_core/src/generate/performance_tracker.dart:300:15)
#28     _SingleBuild._runForInput.<anonymous closure>.<anonymous closure> (package:build_runner_core/src/generate/build_impl.dart:465:23)
<asynchronous suspension>
#29     NoOpTimeTracker.track (package:timing/src/timing.dart:222:44)
#30     _SingleBuild._runForInput.<anonymous closure> (package:build_runner_core/src/generate/build_impl.dart:424:22)
#31     Pool.withResource (package:pool/pool.dart:127:28)
<asynchronous suspension>
#32     _SingleBuild._runForInput (package:build_runner_core/src/generate/build_impl.dart:420:17)
#33     _SingleBuild._runBuilder.<anonymous closure> (package:build_runner_core/src/generate/build_impl.dart:370:38)
#34     MappedIterator.moveNext (dart:_internal/iterable.dart:392:18)
#35     Future.wait (dart:async/future.dart:393:26)
#36     _SingleBuild._runBuilder (package:build_runner_core/src/generate/build_impl.dart:369:36)
<asynchronous suspension>
#37     _SingleBuild._runPhases.<anonymous closure>.<anonymous closure> (package:build_runner_core/src/generate/build_impl.dart:316:20)
<asynchronous suspension>
#38     _NoOpBuildPerformanceTracker.trackBuildPhase (package:build_runner_core/src/generate/performance_tracker.dart:184:15)
#39     _SingleBuild._runPhases.<anonymous closure> (package:build_runner_core/src/generate/build_impl.dart:312:47)
<asynchronous suspension>
#40     NoOpTimeTracker.track (package:timing/src/timing.dart:222:44)
#41     _SingleBuild._runPhases (package:build_runner_core/src/generate/build_impl.dart:306:32)
#42     logTimedAsync (package:build_runner_core/src/logging/logging.dart:25:30)
<asynchronous suspension>
#43     _SingleBuild._safeBuild.<anonymous closure> (package:build_runner_core/src/generate/build_impl.dart:267:26)
<asynchronous suspension>
#44     _rootRun (dart:async/zone.dart:1124:13)
#45     _CustomZone.run (dart:async/zone.dart:1021:19)
#46     _runZoned (dart:async/zone.dart:1516:10)
#47     runZoned (dart:async/zone.dart:1500:12)
#48     _SingleBuild._safeBuild (package:build_runner_core/src/generate/build_impl.dart:262:5)
#49     _SingleBuild.run (package:build_runner_core/src/generate/build_impl.dart:209:24)
<asynchronous suspension>
#50     BuildImpl.run (package:build_runner_core/src/generate/build_impl.dart:97:42)
#51     BuildRunnerDaemonBuilder.build (package:build_runner/src/daemon/daemon_builder.dart:95:35)
<asynchronous suspension>
#52     Server._build.<anonymous closure> (package:build_daemon/src/server.dart:114:25)
#53     Pool.withResource (package:pool/pool.dart:127:28)
<asynchronous suspension>
#54     Server._build (package:build_daemon/src/server.dart:111:13)
#55     Server.listen.<anonymous closure>.<anonymous closure> (package:build_daemon/src/server.dart:77:17)
<asynchronous suspension>
#56     _rootRunUnary (dart:async/zone.dart:1132:38)
#57     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#58     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#59     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#60     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#61     _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
#62     _StreamController._add (dart:async/stream_controller.dart:640:7)
#63     _StreamController.add (dart:async/stream_controller.dart:586:5)
#64     new WebSocketImpl.fromSocket.<anonymous closure> (package:web_socket_channel/src/copy/web_socket_impl.dart:719:21)
#65     _rootRunUnary (dart:async/zone.dart:1132:38)
#66     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#67     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#68     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#69     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#70     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11)
#71     _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
#72     _WebSocketProtocolTransformer._messageFrameEnd (package:web_socket_channel/src/copy/web_socket_impl.dart:316:22)
#73     _WebSocketProtocolTransformer.add (package:web_socket_channel/src/copy/web_socket_impl.dart:214:46)
#74     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
#75     _rootRunUnary (dart:async/zone.dart:1132:38)
#76     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#77     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#78     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#79     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#80     _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
#81     _StreamController._add (dart:async/stream_controller.dart:640:7)
#82     _StreamController.add (dart:async/stream_controller.dart:586:5)
#83     _Socket._onData (dart:io-patch/socket_patch.dart:1774:41)
#84     _rootRunUnary (dart:async/zone.dart:1136:13)
#85     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#86     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#87     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#88     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#89     _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
#90     _StreamController._add (dart:async/stream_controller.dart:640:7)
#91     _StreamController.add (dart:async/stream_controller.dart:586:5)
#92     new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1323:33)
#93     _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:844:14)
#94     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#95     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#96     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:115:13)
#97     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:5)

[SEVERE]Build: Failed after 883ms
refi64 commented 5 years ago

Try master, I'll see if I can get a 0.4.x out soon-ish, though I don't have a working dart install atm.

Yonghang commented 5 years ago

I install vuedart with this commond pub global activate vue_cli, i think this should be master.

h4xhor commented 5 years ago

Hi, I also have the error. So these are the steps I took:

$ pub global activate vue_cli    
$ vuedart create vdTest3    
$ cd vdTest3    
$ pub get
$ webdev serve

Followed by the error:

[SEVERE]vue:vue on lib/my_component.dart: NoSuchMethodError: Class 'RestrictedAnalysisContext' has no instance method 'resolveCompilationUnit' with matching arguments.
Receiver: Instance of 'RestrictedAnalysisContext'
Tried calling: resolveCompilationUnit(Instance of 'FileSource', Instance of 'LibraryElementImpl')
Found: resolveCompilationUnit(Source, LibraryElement) => CompilationUnit

Anyone got vuedart to work? Thanks.

refi64 commented 5 years ago

Okay so can you guys try the v0.4 branch? This should finally fix the issue.

h4xhor commented 5 years ago

Hi refi64, thanks very much for your reply. Ok I've read up on how to select a branch on the pubspec.yaml file https://dart.dev/tools/pub/dependencies and now it looks like this to select v0.4 branch:

  1 name: vdTest3
  2 author: the author
  3 version: 0.1.0
  4 description: Project description goes here
  5 sdk: ">=2.4.0 <3.0.0"
  6 dependencies:
  7   vue:           
  8     git:
  9       url: https://github.com/refi64/vuedart.git
 10       ref: v0.4
 11                    
 12 dev_dependencies:  
 13   build_runner: ^1.6.7
 14   build_web_compilers: ^2.2.3

Now when I run pub get it errors:

$ pub get
Resolving dependencies... (1.3s)
Could not find a file named "pubspec.yaml" in https://github.com/refi64/vuedart.git 88329d24839960ed58d1b76777effdb1dd5d4632.

So may I please ask is this the correct way to pull in v0.4?

refi64 commented 5 years ago

Add path: vue below the url: https://github.com/... line.

On Mon, Aug 26, 2019, 12:04 PM h4xhor notifications@github.com wrote:

Hi refi64, thanks very much for your reply. Ok I've read up on how to select a branch on the pubspec.yaml file https://dart.dev/tools/pub/dependencies and now it looks like this to select v0.4 branch:

1 name: vdTest3 2 author: the author 3 version: 0.1.0 4 description: Project description goes here 5 sdk: ">=2.4.0 <3.0.0" 6 dependencies: 7 vue: 8 git: 9 url: https://github.com/refi64/vuedart.git 10 ref: v0.4 11 12 dev_dependencies: 13 build_runner: ^1.6.7 14 build_web_compilers: ^2.2.3

Now when I run pub get it errors:

$ pub get Resolving dependencies... (1.3s) Could not find a file named "pubspec.yaml" in https://github.com/refi64/vuedart.git 88329d24839960ed58d1b76777effdb1dd5d4632.

So may I please ask is this the correct way to pull in v0.4?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/refi64/vuedart/issues/41?email_source=notifications&email_token=AAM4YSK7EHD4N3GYAHFNLVDQGQEKFA5CNFSM4HQBRQDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5E7XBQ#issuecomment-524942214, or mute the thread https://github.com/notifications/unsubscribe-auth/AAM4YSMVVB46LHUZG3SGREDQGQEKFANCNFSM4HQBRQDA .

h4xhor commented 5 years ago

Wow thanks very much refi64. That worked. Now I get no errors and it works! Thanks a billion! :)

refi64 commented 5 years ago

0.4.2 has been released with a fix.