Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't reactivate fvm after pub cache repair #352

Closed
RomanKapshuk opened this issue Oct 5, 2021 · 15 comments · Fixed by #363
Closed

Can't reactivate fvm after pub cache repair #352

RomanKapshuk opened this issue Oct 5, 2021 · 15 comments · Fixed by #363
Labels
bug Something isn't working

Comments

@RomanKapshuk
Copy link

As a result of fvm flutter pub cache repair at the end of execution I get

Error: Couldn't resolve the package 'fvm' in 'package:fvm/src/runner.dart'.
../../.pub-cache/hosted/pub.dartlang.org/fvm-2.2.3/bin/main.dart:3:8: Error: Not found: 'package:fvm/src/runner.dart'
import 'package:fvm/src/runner.dart';
       ^
../../.pub-cache/hosted/pub.dartlang.org/fvm-2.2.3/bin/main.dart:6:14: Error: Method not found: 'FvmCommandRunner'.
  exit(await FvmCommandRunner().run(args));
             ^^^^^^^^^^^^^^^^
Failed to reactivate fvm 2.2.3: Failed to build fvm:main:
Error: Couldn't resolve the package 'fvm' in 'package:fvm/src/runner.dart'.
../../.pub-cache/hosted/pub.dartlang.org/fvm-2.2.3/bin/main.dart:3:8: Error: Not found: 'package:fvm/src/runner.dart'
import 'package:fvm/src/runner.dart';
       ^
../../.pub-cache/hosted/pub.dartlang.org/fvm-2.2.3/bin/main.dart:6:14: Error: Method not found: 'FvmCommandRunner'.
  exit(await FvmCommandRunner().run(args));
             ^^^^^^^^^^^^^^^^
Binstubs exist for non-activated packages:
  From fvm: fvm
Reactivated 1 package.
Failed to reactivate 1 package:
- fvm
pub finished with exit code 69
@leoafarias
Copy link
Owner

@RomanKapshuk sorry for the delay on this. Are you able to reactivate fvm by calling dart or flutter sdk directly?

@tazik561
Copy link

tazik561 commented Nov 8, 2021

@RomanKapshuk sorry for the delay on this. Are you able to reactivate fvm by calling dart or flutter sdk directly?

For first time fvm is known by terminal, means when I run fvm --version I got true answer. But after running this command flutter pub cache repair and get Error: Couldn't resolve the package 'fvm' in 'package:fvm/src/runner.dart'. error, fvm seems broken and when I run fvm --versionI getzsh: command not found: fvmand I have to rundart pub global activate fvm` again.

@leoafarias
Copy link
Owner

@tazik561 thanks for the details… will have to do some research on this, as I am not sure what fvm is doing differently than any other package.

@btrautmann
Copy link

btrautmann commented Nov 11, 2021

FWIW, I've been noticing this with other packages, so I don't think this is specific to fvm. I've noticed the same with melos and a package that I've been working on and have installed locally.

Edit: Here's output from running pub cache repair on my machine:

Failed to build melos:melos:
Error: Couldn't resolve the package 'melos' in 'package:melos/src/command_runner.dart'.
Error: Couldn't resolve the package 'melos' in 'package:melos/src/common/exception.dart'.
.pub-cache/hosted/pub.dartlang.org/melos-1.0.0-dev.3/bin/melos.dart:3:8: Error: Not found: 'package:melos/src/command_runner.dart'
import 'package:melos/src/command_runner.dart';
       ^
.pub-cache/hosted/pub.dartlang.org/melos-1.0.0-dev.3/bin/melos.dart:4:8: Error: Not found: 'package:melos/src/common/exception.dart'
import 'package:melos/src/common/exception.dart';
       ^
.pub-cache/hosted/pub.dartlang.org/melos-1.0.0-dev.3/bin/melos.dart:8:5: Error: Method not found: 'MelosCommandRunner'.
    MelosCommandRunner().run(arguments);
    ^^^^^^^^^^^^^^^^^^
.pub-cache/hosted/pub.dartlang.org/melos-1.0.0-dev.3/bin/melos.dart:9:8: Error: 'MelosException' isn't a type.
  } on MelosException catch (err) {
       ^^^^^^^^^^^^^^
Failed to reactivate melos 1.0.0-dev.3: Failed to build melos:melos:
Error: Couldn't resolve the package 'melos' in 'package:melos/src/command_runner.dart'.
Error: Couldn't resolve the package 'melos' in 'package:melos/src/common/exception.dart'.
.pub-cache/hosted/pub.dartlang.org/melos-1.0.0-dev.3/bin/melos.dart:3:8: Error: Not found: 'package:melos/src/command_runner.dart'
import 'package:melos/src/command_runner.dart';
       ^
.pub-cache/hosted/pub.dartlang.org/melos-1.0.0-dev.3/bin/melos.dart:4:8: Error: Not found: 'package:melos/src/common/exception.dart'
import 'package:melos/src/common/exception.dart';
       ^
.pub-cache/hosted/pub.dartlang.org/melos-1.0.0-dev.3/bin/melos.dart:8:5: Error: Method not found: 'MelosCommandRunner'.
    MelosCommandRunner().run(arguments);
    ^^^^^^^^^^^^^^^^^^
.pub-cache/hosted/pub.dartlang.org/melos-1.0.0-dev.3/bin/melos.dart:9:8: Error: 'MelosException' isn't a type.
  } on MelosException catch (err) {
       ^^^^^^^^^^^^^^
Reactivating fvm 2.2.3...
Building package executables... 
Failed to build fvm:main:
Error: Couldn't resolve the package 'fvm' in 'package:fvm/src/runner.dart'.
.pub-cache/hosted/pub.dartlang.org/fvm-2.2.3/bin/main.dart:3:8: Error: Not found: 'package:fvm/src/runner.dart'
import 'package:fvm/src/runner.dart';
       ^
.pub-cache/hosted/pub.dartlang.org/fvm-2.2.3/bin/main.dart:6:14: Error: Method not found: 'FvmCommandRunner'.
  exit(await FvmCommandRunner().run(args));
             ^^^^^^^^^^^^^^^^
Failed to reactivate fvm 2.2.3: Failed to build fvm:main:
Error: Couldn't resolve the package 'fvm' in 'package:fvm/src/runner.dart'.
.pub-cache/hosted/pub.dartlang.org/fvm-2.2.3/bin/main.dart:3:8: Error: Not found: 'package:fvm/src/runner.dart'
import 'package:fvm/src/runner.dart';
       ^
.pub-cache/hosted/pub.dartlang.org/fvm-2.2.3/bin/main.dart:6:14: Error: Method not found: 'FvmCommandRunner'.
  exit(await FvmCommandRunner().run(args));
             ^^^^^^^^^^^^^^^^
Reactivating better_lint 1.0.0...
Building package executables... (1.6s)
Built build_runner:graph_inspector.
Built linter:linter.
Built build_runner:build_runner.
Built test:test.
Installed executable better_lint.
Binstubs exist for non-activated packages:
  From melos: melos
  From fvm: fvm
Reactivated 2 packages.
Failed to reactivate 2 packages:
- melos
- fvm

Interestingly in this case the local package I'm developing installed just fine. @leoafarias not sure if there's any similarities between melos and fvm but that may be a starting point if you even feel it's worth the investigation :)

@tazik561
Copy link

rking on and h

I think is because of fvm, I changed FVM to official SDK and the problem is gone. Now I am using official SDK and I don't have a problem .

@leoafarias
Copy link
Owner

I believe I know what is the problem, and has something that has been brought up before. The process is being run by FVM, and during the repair, process fvm is removed.

I am looking into what some of the options might be for the pub global activate fvm install method. The issue will not happen if you install through brew or chocolatey.

Will investigate ways of detaching that process to see if it helps.

@leoafarias
Copy link
Owner

Ok so I took a look, and the solution is to check if the pub command being run might impact the fvm install.

  • Check if command might impact fvm install
  • Check if fvm is installed through pub global (not brew, chocolatey)

If those are true it will go ahead and stop execution and output an explanation and the command you should add to your terminal.

Also since in the case the installation is not repaired and just removed like in the case of dart pub cache clean, it will also output a command to the direct executable to reinstall fvm.

Here is a screenshot:

CleanShot 2021-11-12 at 10 59 23

@btrautmann
Copy link

FWIW I run into this when running dart pub cache repair directly, not via fvm -- not sure if that matters

@ccastroelo
Copy link

Sorry I don't know if I understand correctly.

In a power shell as an administrator. I ran:
dart pub global deactivate fvm
and then:
dart pub global activate fvm

I closed the window and opened it again as an administrator and ran:
fvm dart pub cache repair

I received the following:
Building package executables...
Failed to build fvm:main:
Error: Couldn't resolve the package 'fvm' in 'package:fvm/src/runner.dart'.
AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/fvm-2.2.4/bin/main.dart:3:8: Error: Not found: 'package:fvm/src/runner.dart'
import 'package:fvm/src/runner.dart';
^
AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/fvm-2.2.4/bin/main.dart:6:14: Error: Method not found: 'FvmCommandRunner'.
exit(await FvmCommandRunner().run(args));
^^^^^^^^^^^^^^^^
Failed to reactivate fvm 2.2.4: Failed to build fvm:main:
Error: Couldn't resolve the package 'fvm' in 'package:fvm/src/runner.dart'.
AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/fvm-2.2.4/bin/main.dart:3:8: Error: Not found: 'package:fvm/src/runner.dart'
import 'package:fvm/src/runner.dart';
^
AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/fvm-2.2.4/bin/main.dart:6:14: Error: Method not found: 'FvmCommandRunner'.
exit(await FvmCommandRunner().run(args));
^^^^^^^^^^^^^^^^
Binstubs exist for non-activated packages:
From fvm: fvm
Reactivated 1 package.
Failed to reactivate 1 package:

  • fvm

@leoafarias
Copy link
Owner

As I mentioned pub cache repair is essentially removing the FVM’s own dependencies. That is why you are getting this error. The PR attached once releases will warns the user that the install will be modified and provides instructions on how to execute it safely

@ccastroelo
Copy link

ccastroelo commented Nov 20, 2021

As I mentioned pub cache repair is essentially removing the FVM’s own dependencies. That is why you are getting this error.

ok, I understand.

The PR attached once releases will warns the user that the install will be modified and provides instructions on how to execute it safely.

As stated above, I followed your screenshot, gave the command fvm dart pub cache repair, but it didn't return the instructions for the fix. Here's what he returned:


PS C:\Users\claud> fvm dart pub cache repair
Running using Flutter version configured in path.

Downloading web_socket_channel 1.1.0...
Downloading yaml 2.2.1...
Downloading yaml 3.1.0...
Downloading vm_service 4.1.0...
Downloading vm_service 7.5.0...
Downloading usage 3.4.2...
Downloading usage 4.0.2...
Downloading uuid 2.2.0...
Downloading vector_math 2.1.1...
Downloading webkit_inspection_protocol 0.7.3...
Downloading webkit_inspection_protocol 1.0.0...
Downloading xml 4.2.0...
Downloading webdriver 2.1.2...
Downloading watcher 0.9.7+15...
Downloading typed_data 1.2.0...
Downloading typed_data 1.3.0...
Downloading test_core 0.3.10...
Downloading tint 2.0.0...
Downloading test_api 0.2.17...
Downloading sync_http 0.2.0...
Downloading synchronized 3.0.0...
Downloading test 1.15.2...
Downloading string_scanner 1.0.5...
Downloading string_scanner 1.1.0...
Downloading stream_transform 1.2.0...
Downloading stream_channel 2.0.0...
Downloading stream_channel 2.1.0...
Downloading stack_trace 1.9.5...
Downloading stack_trace 1.10.0...
Downloading term_glyph 1.1.0...
Downloading term_glyph 1.2.0...
Downloading sse 3.5.0...
Downloading sse 4.1.0...
Downloading source_span 1.7.0...
Downloading source_span 1.8.1...
Downloading source_maps 0.10.9...
Downloading source_map_stack_trace 2.0.0...
Downloading shelf_web_socket 0.2.3...
Downloading shelf_static 0.2.8...
Downloading shelf_static 1.1.0...
Downloading shelf_proxy 0.1.0+7...
Downloading shelf_proxy 1.0.1...
Downloading shelf_packages_handler 2.0.0...
Downloading shelf 0.7.5...
Downloading shelf 1.2.0...
Downloading quiver 2.1.3...
Downloading pubspec_parse 0.1.5...
Downloading pub_semver 1.4.4...
Downloading pub_semver 2.1.0...
Downloading process_run 0.12.2+2...
Downloading process 3.0.13...
Downloading pool 1.4.0...
Downloading pool 1.5.0...
Downloading platform 2.2.1...
Downloading petitparser 3.0.4...
Downloading pedantic 1.9.0...
Downloading pedantic 1.11.1...
Downloading path 1.7.0...
Downloading path 1.8.0...
Downloading package_config 1.9.3...
Downloading node_preamble 1.4.12...
Downloading node_io 1.1.1...
Downloading node_interop 1.1.1...
Downloading native_stack_traces 0.3.7...
Downloading mustache_template 1.0.0+1...
Downloading mockito 4.1.1...
Downloading multicast_dns 0.2.2...
Downloading mime 0.9.6+3...
Downloading mime 1.0.1...
Downloading meta 1.1.8...
Downloading meta 1.7.0...
Downloading matcher 0.12.8...
Downloading logging 0.11.4...
Downloading logging 1.0.2...
Downloading json_annotation 3.0.1...
Downloading js 0.6.2...
Downloading io 0.3.4...
Downloading io 1.0.3...
Downloading intl 0.16.1...
Downloading intl 0.17.0...
Downloading http_parser 3.1.4...
Downloading http_parser 4.0.0...
Downloading http_multi_server 2.2.0...
Downloading http_multi_server 3.0.1...
Downloading http 0.12.1...
Downloading http 0.13.4...
Downloading html 0.14.0+3...
Downloading glob 1.2.0...
Downloading fvm 2.2.4...
Downloading flutter_template_images 1.0.1...
Downloading fixnum 0.10.11...
Downloading file_testing 2.1.0...
Downloading file 5.2.1...
Downloading dwds 5.0.0...
Downloading devtools_shared 0.2.5...
Downloading devtools_shared 2.8.0...
Downloading devtools_server 0.2.5...
Downloading devtools_server 2.8.0...
Downloading date_format 2.0.4...
Downloading devtools 0.2.5...
Downloading devtools 2.8.0...
Downloading csslib 0.16.1...
Downloading crypto 2.1.5...
Downloading coverage 0.14.0...
Downloading convert 2.1.1...
Downloading convert 3.0.1...
Downloading console 4.1.0...
Downloading completion 0.2.2...
Downloading collection 1.14.13...
Downloading collection 1.15.0...
Downloading clock 1.1.0...
Downloading cli_util 0.3.5...
Downloading cli_notify 0.0.3...
Downloading checked_yaml 1.0.2...
Downloading charcode 1.1.3...
Downloading charcode 1.3.1...
Downloading built_value 7.1.0...
Downloading built_collection 4.3.2...
Downloading build_daemon 2.1.4...
Downloading browser_launcher 0.1.7...
Downloading browser_launcher 1.0.0...
Downloading boolean_selector 2.0.0...
Downloading async 2.4.2...
Downloading async 2.8.2...
Downloading args 1.6.0...
Downloading args 2.3.0...
Downloading archive 2.0.13...
Downloading analyzer 0.39.12...
Downloading _fe_analyzer_shared 5.0.0...
Reinstalled 129 packages.
Reactivating devtools 2.8.0...
Building package executables...
Built devtools:devtools.
Installed executable devtools.
Reactivating fvm 2.2.4...
Building package executables...
Failed to build fvm:main:
Error: Couldn't resolve the package 'fvm' in 'package:fvm/src/runner.dart'.
AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/fvm-2.2.4/bin/main.dart:3:8: Error: Not found: 'package:fvm/src/runner.dart'
import 'package:fvm/src/runner.dart';
^
AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/fvm-2.2.4/bin/main.dart:6:14: Error: Method not found: 'FvmCommandRunner'.
exit(await FvmCommandRunner().run(args));
^^^^^^^^^^^^^^^^
Failed to reactivate fvm 2.2.4: Failed to build fvm:main:
Error: Couldn't resolve the package 'fvm' in 'package:fvm/src/runner.dart'.
AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/fvm-2.2.4/bin/main.dart:3:8: Error: Not found: 'package:fvm/src/runner.dart'
import 'package:fvm/src/runner.dart';
^
AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/fvm-2.2.4/bin/main.dart:6:14: Error: Method not found: 'FvmCommandRunner'.
exit(await FvmCommandRunner().run(args));
^^^^^^^^^^^^^^^^
Binstubs exist for non-activated packages:
From fvm: fvm
Reactivated 1 package.
Failed to reactivate 1 package:

  • fvm

what do you recommend?

@leoafarias
Copy link
Owner

@ccastroelo this update has not been pushed live add me on telegram and we can discuss. @leoafarias

@ccastroelo
Copy link

@ccastroelo this update has not been pushed live add me on telegram and we can discuss. @leoafarias

please add me. I have never used the telegram and for some reason my account is blocked for non-contacts. @ccastroelo

@ccastroelo
Copy link

After a few unsuccessful attempts I chose to delete the flutter and fvm folders and reinstall everything. And from then on I only got the rights issue when I road the fvm flutter pub get in the project.

As you recommended, I deleted the project's .fvm folder, ran "use" again and everything worked. I believe that with the previous instructions the problem would have been solved, but as there was the old configuration in the project's .fvm and I did the mistake of not deleting it, I was stuck.

Leo, thank you so much for your help and patience.

@leoafarias
Copy link
Owner

Closing this issue has version that addresses this has been pushed live

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants