pulyaevskiy / node-interop

Interop library for writing Node.js apps and modules in Dart.
114 stars 44 forks source link

Not able to correctly import node_io/node_io.dart - some errors #81

Open brilliapps opened 4 years ago

brilliapps commented 4 years ago

The second issue/question - still new to dart

dart --version Dart SDK version: 2.10.0-4.0.dev.flutter-0341576448 (be) (Sat Aug 8 20:25:12 2020 +0000) on "windows_x64" There was "pub get" too

In the below main.dart file simple examples work on node.js like Hello World (just command: webdev build). I tried to import some interop packages for testing/learning. As 'package:node_interop/http.dart' as http; was imported correctly (not using it just imported) package:node_io/node_io.dart show some errors, using command webdev build:

build_web_compilers:entrypoint on web/aqueductnodejs.dart: Skipping compiling aqueductnodejs|web/aqueductnodejs.dart with dart2js because some of its transitive libraries have sdk dependencies that not supported on this platform:

node_io|lib/src/directory.dart node_io|lib/src/http_headers.dart node_io|lib/src/stdout.dart node_io|lib/src/network_interface.dart node_io|lib/src/file.dart node_io|lib/src/streams.dart node_io|lib/node_io.dart node_io|lib/src/internet_address.dart node_io|lib/src/link.dart node_io|lib/src/file_system_entity.dart node_io|lib/src/http_server.dart

https://github.com/dart-lang/build/blob/master/docs/faq.md#how-can-i-resolve-skipped-compiling-warnings

Tried different imports like import 'package:node_interop/io.dart'; (seen heere https://www.youtube.com/watch?v=SFY3he2hcXM) , it doesn't work also.

my dart file import 'dart:async'; import 'dart:convert';

import 'package:node_preamble/preamble.dart' as preamble; import 'package:node_interop/fs.dart'; import 'package:node_interop/node.dart'; //import 'package:node_interop/io.dart'; import 'package:node_io/node_io.dart';

//import 'package:node_interop/fs.dart'; // import 'package:node_interop/http.dart' as http;

Future main() async { print('Server test Hello world!'); }

name: someapp description: A simple command-line application.

version: 1.0.0

homepage: https://www.example.com

environment: sdk: '>=2.8.1 <3.0.0'

dependencies:

path: ^1.7.0

node_preamble: ^1.4.12 node_interop: ^1.1.1 node_io: ^1.1.1

node_io:

git:

url: https://github.com/pulyaevskiy/node-interop

path: node_io

ref: #77

dev_dependencies: pedantic: ^1.9.0 build_runner: '>=1.6.2 <2.0.0' build_web_compilers: '>=2.6.1 <3.0.0'

I am asking anybody for helping with this. If it is too compilcated, please don't feel obliged to waste your time. I assume it is not that difficult for experienced users with node_interop libraries. Right now just need it to work for simple tests. Don't need to reach too far.

brilliapps commented 4 years ago

I see i am not the first one having this problem. For example i followed a solution from this link: https://github.com/pulyaevskiy/node-interop/issues/67 Which changes something but doesn't work anyway. I have this fragment here now: dev_dependencies: pedantic: ^1.9.0 build_runner: '>=1.6.2 <2.0.0' build_web_compilers: '>=2.6.1 <3.0.0'

dependency_overrides: build_node_compilers: git: url: https://github.com/pulyaevskiy/node-interop.git path: build_node_compilers ref: skip-platform-check-for-node-io

And webdev build produces this error:

[SEVERE] The platform ddc, has already been registered.

[SEVERE] Failed to instantiate builder for args with configuration: {} Unhandled exception: Bad state: Unable to start build daemon.

0 _handleDaemonStartup (package:build_daemon/client.dart:82:5)

#1 BuildDaemonClient.connect (package:build_daemon/client.dart:183:11) #2 connectClient (package:webdev/src/daemon_client.dart:17:23) #3 BuildCommand.run (package:webdev/src/command/build_command.dart:57:26) #4 CommandRunner.runCommand (package:args/command_runner.dart:197:27) #5 _CommandRunner.runCommand (package:webdev/src/webdev_command_runner.dart:38:24) #6 CommandRunner.run. (package:args/command_runner.dart:112:25) #7 new Future.sync (dart:async/future.dart:223:31) #8 CommandRunner.run (package:args/command_runner.dart:112:14) #9 run (package:webdev/src/webdev_command_runner.dart:19:56) #10 main (file:///C:/Users/S%C5%82awek/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/webdev-2.5.9/bin/webdev.dart:17:22) #11 _startIsolate. (dart:isolate-patch/isolate_patch.dart:299:32) #12 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12) Anybody has any idea what to do ?