添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

报错如下:

FileSystemException: FileSystemException: Cannot open file, path = '/Users/user/.flutter_tool_state' (OS Error: Permission denied, errno = 13)

详细日志:

Flutter crash report.
Please report a bug at https://github.com/flutter/flutter/issues.
## command
flutter upgrade
## exception
FileSystemException: FileSystemException: Cannot open file, path = '/Users/user/.flutter_tool_state' (OS Error: Permission denied, errno = 13)
#0      _File.throwIfError (dart:io/file_impl.dart:635:7)
#1      _File.openSync (dart:io/file_impl.dart:479:5)
#2      _File.writeAsBytesSync (dart:io/file_impl.dart:604:31)
#3      _File.writeAsStringSync (dart:io/file_impl.dart:628:5)
#4      ForwardingFile.writeAsStringSync (package:file/src/forwarding/forwarding_file.dart:154:16)
#5      ErrorHandlingFile.writeAsStringSync.<anonymous closure> (package:flutter_tools/src/base/error_handling_file_system.dart:186:22)
#6      _runSync (package:flutter_tools/src/base/error_handling_file_system.dart:351:14)
#7      ErrorHandlingFile.writeAsStringSync (package:flutter_tools/src/base/error_handling_file_system.dart:185:5)
#8      Config._flushValues (package:flutter_tools/src/base/config.dart:86:11)
#9      Config.setValue (package:flutter_tools/src/base/config.dart:75:5)
#10     _DefaultPersistentToolState.updateLastActiveVersion (package:flutter_tools/src/persistent_tool_state.dart:109:13)
#11     UpgradeCommandRunner.recordState (package:flutter_tools/src/commands/upgrade.dart:151:33)
#12     UpgradeCommandRunner.runCommandFirstHalf (package:flutter_tools/src/commands/upgrade.dart:138:5)
<asynchronous suspension>
#13     UpgradeCommandRunner.runCommand (package:flutter_tools/src/commands/upgrade.dart:85:13)
#14     UpgradeCommand.runCommand (package:flutter_tools/src/commands/upgrade.dart:60:27)
#15     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:860:18)
#16     _rootRunUnary (dart:async/zone.dart:1198:47)
#17     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
#18     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#19     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#20     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
#21     Future._completeWithValue (dart:async/future_impl.dart:529:5)
#22     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
#23     _rootRun (dart:async/zone.dart:1190:13)
#24     _CustomZone.run (dart:async/zone.dart:1093:19)
#25     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
#26     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
#27     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#28     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#29     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#30     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)
## flutter doctor
[✓] Flutter (Channel stable, 1.20.4, on Mac OS X 10.15.6 19G2021, locale
    zh-Hans-CN)
    • Flutter version 1.20.4 at /Users/user/Flutter/flutterFramework revision fba99f6cf9 (4 weeks ago), 2020-09-14 15:32:52 -0700Engine revision d1bc06f032Dart version 2.9.2Pub download mirror https://pub.flutter-io.cnFlutter download mirror https://storage.flutter-io.cn
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/user/Library/Android/sdkPlatform android-29, build-tools 29.0.3ANDROID_HOME = /Users/user/Library/Android/sdkJava binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/javaJava version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
    • Xcode at /Applications/Xcode.app/Contents/DeveloperXcode 12.0.1, Build version 12A7300CocoaPods version 1.9.3
[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/ContentsFlutter plugin version 49.0.2Dart plugin version 193.7547Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)
[✓] VS Code (version 1.49.1)
    • VS Code at /Applications/Visual Studio Code.app/ContentsFlutter extension version 3.14.1
[!] Connected device
    ! No devices available
! Doctor found issues in 1 category.

解决办法:

iMac ~ % sudo chmod -R 777 /Users/user/.flutter_tool_state

获取权限后再执行 flutter upgrade .

我遇到过执行完权限命令后 执行flutter upgrade依然无效,

打开Mac用户目录(比如:user),command + shift + . 显示隐藏文件

再执行获取权限命令 升级完再隐藏掉隐藏文件.暂不知道为什么,我这样操作就成功升级了

下面是成功升级的log:

user@userdeiMac ~ % sudo chmod -R 777 /Users/user/.flutter_tool_state 
Password:
user@userdeiMac ~ % flutter upgrade
Upgrading Flutter from /Users/user/Flutter/flutter...
Downloading Dart SDK from Flutter engine 75bef9f6c8ac2ed4e1e04cdfcd88b177d9f1850d...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0  172M    0 1164k    0     0  2825k      0  0:01:02 --:--:--  0:01:02 2818k
  7  172M    7 13.3M    0     0  9722k      0  0:00:18  0:00:01  0:00:17 9715k
 12  172M   12 21.0M    0     0  8911k      0  0:00:19  0:00:02  0:00:17 8908k
 17  172M   17 30.1M    0     0  9050k      0  0:00:19  0:00:03  0:00:16 9047k
 22  172M   22 38.0M    0     0  8538k      0  0:00:20  0:00:04  0:00:16 8536k
 22  172M   22 38.6M    0     0  7175k      0  0:00:24  0:00:05  0:00:19 7528k
 23  172M   23 41.2M    0     0  6580k      0  0:00:26  0:00:06  0:00:20 5697k
 25  172M   25 44.8M    0     0  6202k      0  0:00:28  0:00:07  0:00:21 4892k
 28  172M   28 48.6M    0     0  5870k      0  0:00:30  0:00:08  0:00:22 3726k
 29  172M   29 51.4M    0     0  5596k      0  0:00:31  0:00:09  0:00:22 2820k
 32  172M   32 55.5M    0     0  5465k      0  0:00:32  0:00:10  0:00:22 3536k
 34  172M   34 59.4M    0     0  5332k      0  0:00:33  0:00:11  0:00:22 3729k
 36  172M   36 63.5M    0     0  5249k      0  0:00:33  0:00:12  0:00:21 3835k
 40  172M   40 69.1M    0     0  5277k      0  0:00:33  0:00:13  0:00:20 4255k
 43  172M   43 74.5M    0     0  5299k      0  0:00:33  0:00:14  0:00:19 4741k
 46  172M   46 79.4M    0     0  5280k      0  0:00:33  0:00:15  0:00:18 4894k
 50  172M   50 86.4M    0     0  5385k      0  0:00:32  0:00:16  0:00:16 5508k
 54  172M   54 93.8M    0     0  5517k      0  0:00:32  0:00:17  0:00:15 6185k
 58  172M   58  100M    0     0  5615k      0  0:00:31  0:00:18  0:00:13 6522k
 61  172M   61  105M    0     0  5577k      0  0:00:31  0:00:19  0:00:12 6375k
 65  172M   65  112M    0     0  5646k      0  0:00:31  0:00:20  0:00:11 6773k
 69  172M   69  119M    0     0  5709k      0  0:00:30  0:00:21  0:00:09 6772k
 73  172M   73  126M    0     0  5770k      0  0:00:30  0:00:22  0:00:08 6650k
 76  172M   76  131M    0     0  5742k      0  0:00:30  0:00:23  0:00:07 6209k
 80  172M   80  138M    0     0  5817k      0  0:00:30  0:00:24  0:00:06 6750k
 84  172M   84  146M    0     0  5897k      0  0:00:29  0:00:25  0:00:04 6925k
 90  172M   90  155M    0     0  6025k      0  0:00:29  0:00:26  0:00:03 7385k
 94  172M   94  163M    0     0  6104k      0  0:00:28  0:00:27  0:00:01 7604k
 98  172M   98  170M    0     0  6150k      0  0:00:28  0:00:28 --:--:-- 8050k
100  172M  100  172M    0     0  6144k      0  0:00:28  0:00:28 --:--:-- 7978k
Building flutter tool...
Upgrading engine...
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Downloading Material fonts...                                       1.4s
Downloading Android Maven dependencies...                         477.4s (!)
Downloading android-arm-profile/darwin-x64 tools...                 0.6s
Downloading android-arm-release/darwin-x64 tools...                 0.2s
Downloading android-arm64-profile/darwin-x64 tools...               0.2s
Downloading android-arm64-release/darwin-x64 tools...               0.3s
Downloading android-x64-profile/darwin-x64 tools...                 0.9s
Downloading android-x64-release/darwin-x64 tools...                 0.5s
Downloading android-x86 tools...                                    1.4s
Downloading android-x64 tools...                                    1.7s
Downloading android-arm tools...                                    1.0s
Downloading android-arm-profile tools...                            0.6s
Downloading android-arm-release tools...                            0.6s
Downloading android-arm64 tools...                                  1.3s
Downloading android-arm64-profile tools...                          1.0s
Downloading android-arm64-release tools...                          0.5s
Downloading android-x64-profile tools...                            0.5s
Downloading android-x64-release tools...                            0.8s
Downloading android-x86-jit-release tools...                        0.8s
Downloading ios tools...                                            7.3s
Downloading ios-profile tools...                                    2.7s
Downloading ios-release tools...                                   24.3s
Downloading package sky_engine...                                   0.2s
Downloading flutter_patched_sdk tools...                            1.6s
Downloading flutter_patched_sdk_product tools...                    1.4s
Downloading darwin-x64 tools...                                     3.5s
Downloading libimobiledevice...                                     0.1s
Downloading usbmuxd...                                              0.1s
Downloading darwin-x64/font-subset tools...                         0.3s
Flutter 1.22.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f30b7f4db9 (2 days ago) • 2020-10-08 10:06:30 -0700
Engine • revision 75bef9f6c8
Tools • Dart 2.10.1
Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.1, on Mac OS X 10.15.6 19G2021, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.49.1)
[!] Connected device
    ! No devices available
! Doctor found issues in 1 category.
  ╔════════════════════════════════════════════════════════════════════════════╗
  ║                 Welcome to Flutter! - https://flutter.dev                  ║
  ║                                                                            ║
  ║ The Flutter tool uses Google Analytics to anonymously report feature usage ║
  ║ statistics and basic crash reports. This data is used to help improve      ║
  ║ Flutter tools over time.                                                   ║
  ║                                                                            ║
  ║ Flutter tool analytics are not sent on the very first run. To disable      ║
  ║ reporting, type 'flutter config --no-analytics'. To display the current    ║
  ║ setting, type 'flutter config'. If you opt out of analytics, an opt-out    ║
  ║ event will be sent, and then no further information will be sent by the    ║
  ║ Flutter tool.                                                              ║
  ║                                                                            ║
  ║ By downloading the Flutter SDK, you agree to the Google Terms of Service.  ║
  ║ Note: The Google Privacy Policy describes how data is handled in this      ║
  ║ service.                                                                   ║
  ║                                                                            ║
  ║ Moreover, Flutter includes the Dart SDK, which may send usage metrics and  ║
  ║ crash reports to Google.                                                   ║
  ║                                                                            ║
  ║ Read about data we send with crash reports:                                ║
  ║ https://flutter.dev/docs/reference/crash-reporting                         ║
  ║                                                                            ║
  ║ See Google's privacy policy:                                               ║
  ║ https://policies.google.com/privacy                                        ║
  ╚════════════════════════════════════════════════════════════════════════════╝
user@userdeiMac ~ %
复制代码
分类:
iOS
  • Flutter布局和渲染流程
  •