Closed jimmyff closed 3 years ago
Do you have a lower constraint set in your pubspec.yaml
file for the Dart SDK? E.g., if you have 2.11.0
or lower set here:
https://dart.dev/null-safety/migration-guide#sdk-constraints
then null safety should be disabled for your entire project.
@vsmenon on my ubuntu WSL2 machine apt
has installed Dart SDK 2.12.1
and specifying anything lower than that in my pubspec just results in version solving failed.
. Dart is installed via apt get
and I don't believe there is a way to specify a particular version.
Just sanity checking - what do you see if you run:
> pub --version
or
> dart --version
The pub
command is now integrated into the dart
one - do you see anything different if you run:
> dart pub ...
FYI - @mit-mit @leafpetersen - I think the build logs look like an old version of Dart is somehow being used.
Can you please check your path and make sure you don't have an older SDK in there somewhere?
Dart 2.12 has moved pub
to be a subcommand dart pub
, so if you can just run pub
that seems to suggest you have an older SDK in path.
@vsmenon I've tried running dart dart run build_runner build --output=build/
but I get the same result (errors or version solving failed based on SDK in pubspec)
pub --version
Pub 2.12.1
dart --version
Dart SDK version: 2.12.1 (stable) (Unknown timestamp) on "linux_x64"
@mit-mit I've can't find any older SDKs, this is a relatively new install (around 2 months) :
whereis dart
dart: /usr/bin/dart /usr/lib/dart /mnt/d/dev/sdks/flutter/bin/dart /mnt/d/dev/sdks/flutter/bin/dart.bat /usr/lib/dart/bin/dart
/usr/bin/dart --version
Dart SDK version: 2.12.1 (stable) (Unknown timestamp) on "linux_x64"
/usr/lib/dart/bin/dart --version
Dart SDK version: 2.12.1 (stable) (Unknown timestamp) on "linux_x64"
It looks like you also have a version of dart bundled with flutter. What version is that? E.g.,
> flutter --version
> /mnt/d/dev/sdks/flutter/bin/dart --version
Can you also share your pubspec.yaml
and pubspec.lock
files?
@vsmenon I can't run those, they're on the Windows side of things, this is ubuntu running in WSL2. When I try to run them I get /usr/bin/env: ‘bash\r’: No such file or directory
This is the current pubspec but I've tried every combination of values for the sdk constraint. It's a brand new project setup for package:firebase_functions_interop
Ah, build_node_compilers
isn't directly supported by the Dart SDK - it's a different way of invoking Dart compilers and needs its own plumbing to correctly enable/disable null safety.
You can follow their work here:
https://github.com/pulyaevskiy/node-interop/issues/92
In the meantime, you may need to downgrade to 2.11 or lower.
ah, apologies for wasting your time with this then @vsmenon I'll try to figure out how to downgrade my SDK while the node interop package catches up
crikey that was simple, Thanks @vsmenon
sudo apt-get install dart=2.10.3-1
and suddenly it's working, thanks again for your help
I've just started a new project using package:
firebase-functions-interop
I try and run
pub run build_runner build --output=build
and I get so many null safety errors. I understood null soundness was an opt in feature? I haven't opted in yet.I've attempted to run
pub run --no-sound-null-safety build_runner build --output=build
instead and I've also tried adding// @dart=2.9
to my entrypoint file but I still seem to get masses of errors. I've included error logs belowMy development enviroment feels a bit of a mess right now, between package dependency hell and crazy amounts of null saftey errors. Am I missing something, do I need to take the plunge and try null soundess to make all these errors go away? I need to resolve these issues so I can focus on my projects again rather than constnatly trying to make dart work. I use dart on web client, flutter & server so need my packages to work in all these scenarios.
Thanks
Build logs
``` [INFO] Generating build script... [INFO] Generating build script completed, took 256ms [INFO] Creating build script snapshot...... [INFO] Creating build script snapshot... completed, took 7.8s [INFO] Initializing inputs [INFO] Building new asset graph... [INFO] Building new asset graph completed, took 796ms [INFO] Checking for unexpected pre-existing outputs.... [INFO] Checking for unexpected pre-existing outputs. completed, took 1ms [INFO] Running build... [INFO] 1.1s elapsed, 76/86 actions completed. [INFO] 2.1s elapsed, 169/188 actions completed. [INFO] 3.1s elapsed, 294/308 actions completed. [INFO] 4.2s elapsed, 318/322 actions completed. [INFO] 5.3s elapsed, 375/379 actions completed. [INFO] 6.4s elapsed, 495/504 actions completed. [INFO] 7.5s elapsed, 550/554 actions completed. [INFO] 8.6s elapsed, 667/671 actions completed. [INFO] 9.7s elapsed, 724/726 actions completed. [INFO] 10.8s elapsed, 773/775 actions completed. [INFO] 11.9s elapsed, 811/895 actions completed. [SEVERE] build_node_compilers:ddc on package:pedantic/pedantic.ddc_node.module: Error compiling dartdevc module:pedantic|lib/pedantic.ddc_node.js packages/pedantic/pedantic.dart:23:28: Error: Null safety features are disabled for this library. Try removing the package language version or setting the language version to 2.10 or higher. void unawaited(Future