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

fix: permissions issues windows + path error #840

Closed
zakblacki opened this issue Jul 13, 2023 · 9 comments · Fixed by #964
Closed

fix: permissions issues windows + path error #840

zakblacki opened this issue Jul 13, 2023 · 9 comments · Fixed by #964
Assignees
Labels
bug Something isn't working waiting for response Waiting for customer response

Comments

@zakblacki
Copy link

zakblacki commented Jul 13, 2023

Description

Clean fresh new installation is not detecting flutter path and some commands are not working like shorebird cache clean

Steps To Reproduce

  • After install launch CMD with admin access
  • use shorebird doctor or shorebird cache clean

Here is result :

shorebird cache clean
Unhandled exception:
PathAccessException: Deletion failed, path = 'C:\Users\zakbl.shorebird\bin\cache' (OS Error: Access is denied.
, errno = 5)
#0 _Directory._deleteSync (dart:io/directory_impl.dart:193:7)
#1 FileSystemEntity.deleteSync (dart:io/file_system_entity.dart:424:7)
#2 Cache.clear (package:shorebird_cli/src/cache.dart:79:16)
#3 CleanCacheCommand.run (package:shorebird_cli/src/commands/cache/clean_cache_command.dart:27:11)
#4 CommandRunner.runCommand (package:args/command_runner.dart:212:27)
#5 CompletionCommandRunner.runCommand (package:cli_completion/src/command_runner/completion_command_runner.dart:81:18)
#6 ShorebirdCliCommandRunner.runCommand (package:shorebird_cli/src/command_runner.dart:151:30)
#7 ShorebirdCliCommandRunner.run. (package:shorebird_cli/src/command_runner.dart:97:19)
#8 _rootRun (dart:async/zone.dart:1399:13)
#9 _CustomZone.run (dart:async/zone.dart:1301:19)
#10 _runZoned (dart:async/zone.dart:1804:10)
#11 runZoned (dart:async/zone.dart:1747:10)
#12 runScoped (package:scoped/src/scoped.dart:64:10)
#13 ShorebirdCliCommandRunner.run (package:shorebird_cli/src/command_runner.dart:96:20)
#14 main. (file:///C:/Users/zakbl/.shorebird/packages/shorebird_cli/bin/shorebird.dart:13:47)
#15 _rootRun (dart:async/zone.dart:1399:13)
#16 _CustomZone.run (dart:async/zone.dart:1301:19)
#17 _runZoned (dart:async/zone.dart:1804:10)
#18 runZoned (dart:async/zone.dart:1747:10)
#19 runScoped (package:scoped/src/scoped.dart:64:10)
#20 main (file:///C:/Users/zakbl/.shorebird/packages/shorebird_cli/bin/shorebird.dart:12:11)
#21 _delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:294:33)
#22 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12)`

`>shorebird doctor

Shorebird v0.9.1
Shorebird Engine • revision 6c1f35b941ba46596b88674cbb7c59ac3eff1119
✓ Shorebird is up-to-date (1.1s)
✗ Flutter install is correct (2.0s)
[✗] Failed to determine Shorebird Flutter version. FlutterValidationException: Flutter version check did not complete successfully.

1 issue detected.`

and here is my flutter doctor -v

` [√] Flutter (Channel stable, 3.10.5, on Microsoft Windows [Version 10.0.19045.3208], locale en-US)
• Flutter version 3.10.5 on channel stable at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 796c8ef792 (4 weeks ago), 2023-06-13 15:51:02 -0700
• Engine revision 45f6e00911
• Dart version 3.0.5
• DevTools version 2.23.1
• Pub download mirror https://pub.flutter-io.cn

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\zakbl\AppData\Local\Android\Sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = C:\Users\zakbl\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
• All Android licenses accepted.

[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2022.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)

[√] VS Code (version 1.80.0)
• VS Code at C:\Users\zakbl\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.68.0

[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.3208]
• Chrome (web) • chrome • web-javascript • Google Chrome 114.0.5735.199
• Edge (web) • edge • web-javascript • Microsoft Edge 114.0.1823.67

[√] Network resources
• All expected network resources are available.`

As you can see this is not normal

@zakblacki zakblacki added the bug Something isn't working label Jul 13, 2023
@zakblacki zakblacki changed the title fix: permissions issues windows fix: permissions issues windows + path error Jul 13, 2023
@eseidel
Copy link
Contributor

eseidel commented Jul 13, 2023

Shorebird should not require admin access to install. But now that it's installed with admin, the only way to remove it is with admin. I suspect you'll find that the $HOME/.shorebird directory is owned by Admin which means your normal user can modify it (including deleting the cache files). I would recommend using admin to rmdir ~/.shorebird and then re-installing w/o using admin.

Let me know if I've misunderstood. Thanks!

@zakblacki
Copy link
Author

Shorebird should not require admin access to install. But now that it's installed with admin, the only way to remove it is with admin. I suspect you'll find that the $HOME/.shorebird directory is owned by Admin which means your normal user can modify it (including deleting the cache files). I would recommend using admin to rmdir ~/.shorebird and then re-installing w/o using admin.

Let me know if I've misunderstood. Thanks!

Let me rectify I did not install shorebird as admin it was regular but when I open the commands tool (cmd terminal) I did with admin, because this should had solved the permission issue mentioned at the top but it did not.

Also the second the error is unrelated so I'm a little confused here

@eseidel
Copy link
Contributor

eseidel commented Jul 16, 2023

If you ever run a shorebird command as admin, it's possible it will create a cache directory which will be owned by admin rather than your user. Then later attempts to run shorebird as your user will fail. Could that be what's happening here?

I'd recommend removing ~/.shorebird and re-installing (as a user, rather than admin) and see if that fixes the problem?

@zakblacki
Copy link
Author

I did as instructed deleted and reinstall at first the shorebird doctor command worked but only once but after closing terminal and retry it caused the same issue mentioned up, same thing for shorebird cache clean

So I don't think this can be solved on my end, tested both user and admin

@eseidel
Copy link
Contributor

eseidel commented Jul 24, 2023

I'm not sure how to help. If you could paste newer logs that might help. But in your original log, shorebird clean is failing to have access to its own cache directory, which is most likely caused by the user its running as, not having access to that cache dir. I guess we could add logic to specifically detect and report that case.

shorebird cache clean
Unhandled exception:
PathAccessException: Deletion failed, path = 'C:\Users\zakbl.shorebird\bin\cache' (OS Error: Access is denied.
, errno = 5)

Also, that path looks wrong, now that I look at it. C:\Users\zakbl.shorebird\bin\cache is missing a \ right before the .shorebird.

@eseidel eseidel added the waiting for response Waiting for customer response label Jul 26, 2023
@zakblacki
Copy link
Author

zakblacki commented Jul 31, 2023

Sorry for delay, I've tried both with and without admin privilege permission (cmd, powershell)

so I thought maybe I should change installation path shorebird instead of default
alternatively maybe I should pinpoint the flutter path manually in shorebird

Edit : I noticed that sometimes right after install I try to launch shorebird doctor it does detect flutter path (but it works only once) after that If I close terminal or retry command the error below happens

I'm not sure how to help. If you could paste newer logs that might help. But in your original log, shorebird clean is failing to have access to its own cache directory, which is most likely caused by the user its running as, not having access to that cache dir. I guess we could add logic to specifically detect and report that case.

shorebird cache clean
Unhandled exception:
PathAccessException: Deletion failed, path = 'C:\Users\zakbl.shorebird\bin\cache' (OS Error: Access is denied.
, errno = 5)

Also, that path looks wrong, now that I look at it. C:\Users\zakbl.shorebird\bin\cache is missing a \ right before the .shorebird.

` C:\Users\zakbl>shorebird doctor

Shorebird v0.11.1
Shorebird Engine • revision 3531f1ab7af264b4972c41ab5fdab72601c20444

✓ Shorebird is up-to-date (1.9s)
✗ Flutter install is correct (1.9s)
  [✗] Failed to determine Shorebird Flutter version. FlutterValidationException: Flutter version check did not complete successfully.
1 issue detected.

C:\Users\zakbl>shorebird cache clean
Unhandled exception:
PathAccessException: Deletion failed, path = 'C:\Users\zakbl\.shorebird\bin\cache' (OS Error: Access is denied.
, errno = 5)
#0      _Directory._deleteSync (dart:io/directory_impl.dart:193:7)
#1      FileSystemEntity.deleteSync (dart:io/file_system_entity.dart:424:7)
#2      Cache.clear (package:shorebird_cli/src/cache.dart:102:16)
#3      CleanCacheCommand.run (package:shorebird_cli/src/commands/cache/clean_cache_command.dart:28:11)
#4      CommandRunner.runCommand (package:args/command_runner.dart:212:27)
#5      CompletionCommandRunner.runCommand (package:cli_completion/src/command_runner/completion_command_runner.dart:81:18)
#6      ShorebirdCliCommandRunner.runCommand (package:shorebird_cli/src/command_runner.dart:151:30)
#7      ShorebirdCliCommandRunner.run.<anonymous closure> (package:shorebird_cli/src/command_runner.dart:94:19)
#8      _rootRun (dart:async/zone.dart:1399:13)
#9      _CustomZone.run (dart:async/zone.dart:1301:19)
#10     _runZoned (dart:async/zone.dart:1804:10)
#11     runZoned (dart:async/zone.dart:1747:10)
#12     runScoped (package:scoped/src/scoped.dart:64:10)
#13     ShorebirdCliCommandRunner.run (package:shorebird_cli/src/command_runner.dart:93:20)
#14     main.<anonymous closure> (file:///C:/Users/zakbl/.shorebird/packages/shorebird_cli/bin/shorebird.dart:23:47)
#15     _rootRun (dart:async/zone.dart:1399:13)
#16     _CustomZone.run (dart:async/zone.dart:1301:19)
#17     _runZoned (dart:async/zone.dart:1804:10)
#18     runZoned (dart:async/zone.dart:1747:10)
#19     runScoped (package:scoped/src/scoped.dart:64:10)
#20     main (file:///C:/Users/zakbl/.shorebird/packages/shorebird_cli/bin/shorebird.dart:22:11)
#21     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:294:33)
#22     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12)`


` C:\Users\zakbl>flutter doctor -v
[√] Flutter (Channel stable, 3.10.6, on Microsoft Windows [Version 10.0.19045.3271], locale en-US)
    • Flutter version 3.10.6 on channel stable at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f468f3366c (3 weeks ago), 2023-07-12 15:19:05 -0700
    • Engine revision cdbeda788a
    • Dart version 3.0.6
    • DevTools version 2.23.1
    • Pub download mirror https://pub.flutter-io.cn

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\zakbl\AppData\Local\Android\Sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = C:\Users\zakbl\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2022.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)

[√] VS Code (version 1.80.1)
    • VS Code at C:\Users\zakbl\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.68.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19045.3271]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 115.0.5790.110
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 114.0.1823.67

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.`

@eseidel eseidel moved this to Customers in Adoption Blockers Aug 1, 2023
@eseidel
Copy link
Contributor

eseidel commented Aug 1, 2023

I don't think this is the problem, but I see:
• Pub download mirror https://pub.flutter-io.cn, and know that we may have issues with proxy configs: #435

I wonder if something is still running and holding open the lock on the directory? Windows won't let you delete a directory if something is still using it:

C:\Users\zakbl>shorebird cache clean
Unhandled exception:
PathAccessException: Deletion failed, path = 'C:\Users\zakbl\.shorebird\bin\cache' (OS Error: Access is denied.
, errno = 5)

I think we need to add more diagnostics to shorebird doctor in order to help here. I've added this to our current milestone.

@zakblacki
Copy link
Author

zakblacki commented Aug 1, 2023

I don't think this is the problem, but I see: • Pub download mirror https://pub.flutter-io.cn, and know that we may have issues with proxy configs: #435

I wonder if something is still running and holding open the lock on the directory? Windows won't let you delete a directory if something is still using it:

C:\Users\zakbl>shorebird cache clean
Unhandled exception:
PathAccessException: Deletion failed, path = 'C:\Users\zakbl\.shorebird\bin\cache' (OS Error: Access is denied.
, errno = 5)

I think we need to add more diagnostics to shorebird doctor in order to help here. I've added this to our current milestone.

hope you put this a priority cause I can't use this on my windows
either way I'm able to delete the directory the cache folder manually without issue so I doubt

@zakblacki
Copy link
Author

zakblacki commented Aug 2, 2023

Edit : I also receive error when using shorebird init on existing project

C:\Users\zakbl\AndroidStudioProjects\delivery_active>shorebird init
✓ Detecting product flavors (16.7s)
? How should we refer to this app? (active_flutter_delivery_app) active_flutter_delivery_app
Failed to obtain access credentials. Error: invalid_grant Bad Request Status code: 400`
```

Edit 2 : I should had mentioned my flutter default path is  C:\flutter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting for response Waiting for customer response
Projects
No open projects
Status: Done
3 participants