pulyaevskiy / firebase-functions-interop

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

Having difficulties building #48

Closed jimmyff closed 5 years ago

jimmyff commented 5 years ago

When I try to build I get the error below. I doesn't list any imports for me check. Is there a way I can figure out what is library or source is the cause of the problems?

> functions@ build /Users/jimmyff/Development/datingnode/functions
> pub run build_runner build --output=build

[INFO] Generating build script completed, took 319ms
[INFO] Reading cached asset graph completed, took 253ms
[INFO] Checking for updates since last build completed, took 785ms
[INFO] Running build completed, took 184ms
[INFO] Caching finalized dependency graph completed, took 149ms
[SEVERE] build_node_compilers|entrypoint on node/index.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:

[SEVERE] Failed after 349ms
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ build: `pub run build_runner build --output=build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the functions@ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jimmyff/.npm/_logs/2019-03-19T12_29_35_126Z-debug.log
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

This is the contents of /Users/jimmyff/.npm/_logs/2019-03-19T12_29_35_126Z-debug.log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm@6.4.1
3 info using node@v8.9.1
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle functions@~prebuild: functions@
6 info lifecycle functions@~build: functions@
7 verbose lifecycle functions@~build: unsafe-perm in lifecycle true
8 verbose lifecycle functions@~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/jimmyff/Development/datingnode/functions/node_modules/.bin://chromium_depot_tools:/Users/jimmyff/flutter-sdk/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/git/bin:~/.pub-cache/bin
9 verbose lifecycle functions@~build: CWD: /Users/jimmyff/Development/datingnode/functions
10 silly lifecycle functions@~build: Args: [ '-c', 'pub run build_runner build --output=build' ]
11 silly lifecycle functions@~build: Returned: code: 1  signal: null
12 info lifecycle functions@~build: Failed to exec build script
13 verbose stack Error: functions@ build: `pub run build_runner build --output=build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:925:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid functions@
15 verbose cwd /Users/jimmyff/Development/datingnode/functions
16 verbose Darwin 18.0.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v8.9.1
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error functions@ build: `pub run build_runner build --output=build`
22 error Exit status 1
23 error Failed at the functions@ build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
jimmyff commented 5 years ago

The only dependencies of the project are:

  firebase_functions_interop: ^1.0.0
  firebase_admin_interop: any
  core:
    path: ../core

and core uses:

  redux: ^3.0.0
  redux_logging: ^0.3.0
  intl: any
  http: ^0.12.0
  key_value_store: ^1.0.0
  built_value: ^6.3.0
  built_collection: ^4.1.0

although redux, redux_logging, http & key_value_store should be excluded via tree-shaking.

jimmyff commented 5 years ago

I've tracked down the problem that causing instant failure: importing a file that was exporting files that were utilising the redux packages.

pulyaevskiy commented 5 years ago

Sorry for late reply here. Just curious why would redux packages cause an issue here?

jimmyff commented 5 years ago

The only two redux packages my core project use are:

  redux: ^3.0.0
  redux_logging: ^0.3.0

From my functions project when I imported my core project main file (package:core/core.dart) this was causing the build failiure. I then commented out the exports in core.dart that referenced the redux part of my app and it fixed the build issue.

Most likely it's a bug I've introduced in the redux part of my app but as my firestore functions don't need redux I've just separated that out in to a different file.