pulyaevskiy / firebase-functions-interop

Firebase Functions Interop Library for Dart.
BSD 3-Clause "New" or "Revised" License
191 stars 52 forks source link

build_runner can't find file #45

Closed Jonas-Sander closed 5 years ago

Jonas-Sander commented 5 years ago

I exactly followed all your installing steps and got this error (verbose for more info):

E:\Development\Projects\XXX\XXX\myproject\functions>pub run build_runner build -v --output=build
[INFO] Generating build script completed, took 581ms
[INFO] BuildDefinition:Initializing inputs
[INFO] BuildDefinition:Reading cached asset graph...
[INFO] BuildDefinition:Reading cached asset graph completed, took 318ms

[INFO] BuildDefinition:Checking for updates since last build...
[INFO] BuildDefinition:Checking for updates since last build completed, took 679ms

[INFO] Build:Running build...
[INFO] Build:Running build completed, took 240ms

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

[SEVERE] build_node_compilers|entrypoint on node/index.dart (cached):

ProcessException: Das System kann die angegebene Datei nicht finden.

  Command: E:\Development\flutter\bin\cache\dart-sdk\bin\dart2js.bat --batch
package:build_modules/src/workers.dart 268:22                           _Dart2JsWorker._worker.<fn>
package:build_modules/src/workers.dart 279:6                            _Dart2JsWorker._worker
package:build_modules/src/workers.dart 298:26                           _Dart2JsWorker.doJob
package:build_modules/src/workers.dart 217:14                           Dart2JsBatchWorkerPool._startWorkQueue.<fn>
package:build_modules/src/workers.dart 221:6                            Dart2JsBatchWorkerPool._startWorkQueue
package:build_modules/src/workers.dart 189:26                           Dart2JsBatchWorkerPool.compile
package:build_node_compilers/src/dart2js_bootstrap.dart 48:30           bootstrapDart2Js
package:build_node_compilers/src/node_entrypoint_builder.dart 103:13    NodeEntrypointBuilder.build
package:build                                                           runBuilder
package:build_runner_core/src/generate/build_impl.dart 455:19           _SingleBuild._runForInput.<fn>.<fn>.<fn>
package:build_runner_core/src/generate/performance_tracker.dart 303:15  _NoOpBuilderActionTracker.trackStage
package:build_runner_core/src/generate/build_impl.dart 453:23           _SingleBuild._runForInput.<fn>.<fn>
package:timing/src/timing.dart 222:44                                   NoOpTimeTracker.track
package:build_runner_core/src/generate/build_impl.dart 412:22           _SingleBuild._runForInput.<fn>
dart:async                                                              new Future.sync
package:pool/pool.dart 126:18                                           Pool.withResource.<fn>

[SEVERE] Build:
Failed after 481ms

"Das System kann die angegebene Datei nicht finden." means "The system can not find the stated/given file." in german.

My data structure:
cloud-functions

I'm using Dart Dart VM version: 2.1.0-dev.9.4.flutter-f9ebf21297 (Thu Nov 8 23:00:07 2018 +0100) on "windows_x64" from Flutter.

Content of index.dart:

import 'package:firebase_functions_interop/firebase_functions_interop.dart';

void main() {
  functions['helloWorld'] = functions.https.onRequest(helloWorld);
}

void helloWorld(ExpressHttpRequest request) {
  request.response.writeln('Hello world');
  request.response.close();
}

Content of build.yaml:

targets:
  $default:
    sources:
      - "node/**"
      - "lib/**"
    builders:
      build_node_compilers|entrypoint:
        generate_for:
        - node/**
        options:
          compiler: dart2js
          # List any dart2js specific args here, or omit it.
          dart2js_args:
          - --minify

Content of pubspec.yaml:

name: myproject_functions
description: My project functions
version: 0.0.1

environment:
  sdk: '>=2.0.0-dev <3.0.0'

dependencies:
  # Firebase Functions bindings
  firebase_functions_interop: ^1.0.0

dev_dependencies:
  # Needed to compile Dart to valid Node.js module.
  build_runner: ^1.0.0
  build_node_compilers: ^0.2.0

Can someone resolve this or should I post this at the Repo of build_runner?

pulyaevskiy commented 5 years ago

I see that you're using version of Dart SDK that comes with Flutter installation. Unfortunately that version would not work as it's stripped of necessary tooling required to compile Dart to JavaScript.

You'd need to install standalone version of Dart, see instructions for your platform here: https://www.dartlang.org/tools/sdk#install

I personally have the standalone Dart SDK being my default installation so that all command line tools (dart, pub,...) point to it. I also have Flutter installed but only flutter tool is available from the CLI.

Jonas-Sander commented 5 years ago

Yes, thank you very much!