Open dmrickey opened 1 year ago
There might be something wrong with your development environment.
My understanding is that the terminal's PATH variable does not include Flutter's location.
If you open a new terminal and run flutter pub get
, does that work?
Yes, flutter
appears to be correctly set up in my path, that successfully fetched dependencies
In that case that's going to be quite hard for me to debug.
I've never had this error, so without knowing about your environment, that's going to be difficult.
I investigated more into the issue. After trashing my update and digging into it more on 0.4.0 it was because multiple of our packages (living side-by-side in the same repo) were referencing different versions of the same dependency which kept custom_lints from launching. The error given in 0.4.0 was much more obvious about this. I don't know if 0.5.2 was having issues because of this, but on 0.4.0 it's working now after making sure everything was using the same versions.
Sounds like there is a bug if 0.5.2 doesn't catch this or give a proper error message. But I need to know what caused this.
Could you share the pubspec.yamls and .dart_tool/package_config.json
of all the packages in your repo? (before fixing the problem of course)
Here's an example from the log before I updated all our dependencies. Just to clarify, this is on 0.4.0. And the packages mentioned in the log aren't direct dependencies, they're dependencies of dependencies (i.e. dart_style
is not listed in any of our pubspecs, but it's a dependency of packages that are listed in our pubspecs).
All of our packages rely on a single "shared" package, so I resolved this by defining our dependency versions only in shared, then in every other package I removed the specific version dependency. So only shared is "installing" dependencies and the rest of our packages are just resolving what shared has already installed.
If you need specific examples of our pubspecs beyond this let me know.
I'm not seeing that we have any .dart_tool/package_config.json
at all
The request analysis.setContextRoots failed with the following error: RequestErrorCode.PLUGIN_ERROR PackageVersionConflictError β Some dependencies with conflicting versions were identified:
Package dart_style:
- Hosted with version constraint: ^2.2.1 Resolved with C:\Users\davidrickey\AppData\Local\Pub\Cache\hosted\pub.dev\dart_style-2.3.1\ Used by plugin "custom_lints" at "........\Documents\repos\rnm-flutter\packages\custom_lints" in the project "airplay_controller" at "........\Documents\repos\rnm-flutter\plugins\airplay_controller"
- Hosted with version constraint: ^2.2.1 Resolved with C:\Users\davidrickey\AppData\Local\Pub\Cache\hosted\pub.dev\dart_style-2.3.1\ Used by plugin "custom_lints" at "........\Documents\repos\rnm-flutter\packages\custom_lints" in the project "butter_player" at "........\Documents\repos\rnm-flutter\plugins\butter_player"
- Hosted with version constraint: ^2.2.1 Resolved with C:\Users\davidrickey\AppData\Local\Pub\Cache\hosted\pub.dev\dart_style-2.3.1\ Used by plugin "custom_lints" at "........\Documents\repos\rnm-flutter\packages\custom_lints" in the project "butter_player_example" at "........\Documents\repos\rnm-flutter\plugins\butter_player\example"
- Hosted with version constraint: ^2.2.1 Resolved with C:\Users\davidrickey\AppData\Local\Pub\Cache\hosted\pub.dev\dart_style-2.3.1\ Used by plugin "custom_lints" at "........\Documents\repos\rnm-flutter\packages\custom_lints" in the project "data_providers" at "........\Documents\repos\rnm-flutter\packages\data_providers"
- Hosted with version constraint: ^2.2.1 Resolved with C:\Users\davidrickey\AppData\Local\Pub\Cache\hosted\pub.dev\dart_style-2.3.1\ Used by plugin "custom_lints" at "........\Documents\repos\rnm-flutter\packages\custom_lints" in the project "repositories" at "........\Documents\repos\rnm-flutter\packages\repositories"
- Hosted with version constraint: ^2.2.1 Resolved with C:\Users\davidrickey\AppData\Local\Pub\Cache\hosted\pub.dev\dart_style-2.3.2\ Used by plugin "custom_lints" at "........\Documents\repos\rnm-flutter\packages\custom_lints" in the project "rnm_flutter" at "........\Documents\repos\rnm-flutter"
- Hosted with version constraint: ^2.2.1 Resolved with C:\Users\davidrickey\AppData\Local\Pub\Cache\hosted\pub.dev\dart_style-2.3.1\ Used by plugin "custom_lints" at "........\Documents\repos\rnm-flutter\packages\custom_lints" in the project "shared" at "........\Documents\repos\rnm-flutter\packages\shared"
Package vm_service:
- Hosted with version constraint: >=6.0.1 <12.0.0 Resolved with C:\Users\davidrickey\AppData\Local\Pub\Cache\hosted\pub.dev\vm_service-11.7.1\ Used by plugin "custom_lints" at "........\Documents\repos\rnm-flutter\packages\custom_lints" in the project "airplay_controller" at "........\Documents\repos\rnm-flutter\plugins\airplay_controller"
- Hosted with version constraint: >=6.0.1 <12.0.0 Resolved with C:\Users\davidrickey\AppData\Local\Pub\Cache\hosted\pub.dev\vm_service-11.7.1\ Used by plugin "custom_lints" at "........\Documents\repos\rnm-flutter\packages\custom_lints" in the project "butter_player" at "........\Documents\repos\rnm-flutter\plugins\butter_player"
- Hosted with version constraint: >=6.0.1 <12.0.0 Resolved with C:\Users\davidrickey\AppData\Local\Pub\Cache\hosted\pub.dev\vm_service-11.7.1\ Used by plugin "custom_lints" at "........\Documents\repos\rnm-flutter\packages\custom_lints" in the project "butter_player_example" at "........\Documents\repos\rnm-flutter\plugins\butter_player\example"
- Hosted with version constraint: >=6.0.1 <12.0.0 Resolved with C:\Users\davidrickey\AppData\Local\Pub\Cache\hosted\pub.dev\vm_service-11.7.1\ Used by plugin "custom_lints" at "........\Documents\repos\rnm-flutter\packages\custom_lints" in the project "data_providers" at "........\Documents\repos\rnm-flutter\packages\data_providers"
- Hosted with version constraint: >=6.0.1 <12.0.0 Resolved with C:\Users\davidrickey\AppData\Local\Pub\Cache\hosted\pub.dev\vm_service-11.7.1\ Used by plugin "custom_lints" at "........\Documents\repos\rnm-flutter\packages\custom_lints" in the project "repositories" at "........\Documents\repos\rnm-flutter\packages\repositories"
- Hosted with version constraint: >=6.0.1 <12.0.0 Resolved with C:\Users\davidrickey\AppData\Local\Pub\Cache\hosted\pub.dev\vm_service-11.7.2\ Used by plugin "custom_lints" at "........\Documents\repos\rnm-flutter\packages\custom_lints" in the project "rnm_flutter" at "........\Documents\repos\rnm-flutter"
- Hosted with version constraint: >=6.0.1 <12.0.0 Resolved with C:\Users\davidrickey\AppData\Local\Pub\Cache\hosted\pub.dev\vm_service-11.7.1\ Used by plugin "custom_lints" at "........\Documents\repos\rnm-flutter\packages\custom_lints" in the project "shared" at "........\Documents\repos\rnm-flutter\packages\shared"
This is not supported. Custom_lint shares the analysis between all packages. As such, all plugins are started under a single process, sharing the dependencies of all the packages that use custom_lint. Since there's a single process for all plugins, if 2 plugins try to use different versions for a dependency, the process cannot be reasonably started. Please make sure all packages have the same version. You could run the following commands to try fixing this:
I'm not seeing that we have any
.dart_tool/package_config.json
at all
You most definitely have some. There's no way to generate an error such as the one linked above without such a file. You should have one for every pubspec file in your project.
That's what pub get
does, it creates this json file.
I'd be curious to see what the error was (the compilation error that preventing plugins from starting).
Do you think you could create a small repo for me to reproduce the error? That would help massively in debugging this.
Just get the error here as well
`The Dart VM service is listening on http://127.0.0.1:51581/8JT4cWjeDPw=/ The Dart DevTools debugger and profiler is available at: http://127.0.0.1:51581/8JT4cWjeDPw=/devtools?uri=ws://127.0.0.1:51581/8JT4cWjeDPw=/ws [custom_lint] 2023-09-02T14:45:24.074255 lib/custom_lint_client.dart:13:37: Error: Undefined name 'createPlugin'. [custom_lint] 2023-09-02T14:45:24.074255 {'partner_lints': partner_lints.createPlugin, [custom_lint] 2023-09-02T14:45:24.074255 ^^^^^^^^^^^^ [custom_lint] 2023-09-02T14:45:24.074255 [custom_lint] 2023-09-02T14:45:24.074255 Failed to start pluginsThe request analysis.setContextRoots failed with the following error: RequestErrorCode.PLUGIN_ERROR Bad state: Failed to start the plugins. at:
According to this error, you did not define a createPlugin
function in lib/<your_package_name>.dart
This? I was just following your fluttercon talk and trying to re-create the same code
Yes. Make sure that this createPlugin
is in the right location.
It is imported with package:<your_package_name>/<your_package_name>.dart'
, so at the root of the lib folder
From that error, it sounds like you defined it in a different place. Maybe it's in the lib/src folder
In fact, my mistake, the main file was main.dart... I'm sorry =/ Rename the file and it's working... Thank you for your time
No worries, the error isn't super clear :) There are plans to make this smoother https://github.com/invertase/dart_custom_lint/issues/96
The log only includes this
We were using 0.4.0 and I noticed our custom lints weren't running. So I updated them to the latest 0.5.2 and they're still not working. Does the above tell you what's going on?