flutter - 当“颤振升级”时,我得到“权限被拒绝”错误
问题描述
我想用 Flutter 构建一个 Web 应用程序。我遵循了这个指示。https://flutter.dev/docs/get-started/web 我使用 Windows 10、适用于 Linux 的 Windows 子系统、Debian 10。
我在目录中安装了 Flutter SDK~/development/
并且已经设置了路径。
我输入这个。
flutter channel beta
并得到这个结果。
Switching to flutter channel 'beta'...
git: From https://github.com/flutter/flutter
git: 5f21edf8b..b041144f8 stable -> origin/stable
git: * [new branch] CareF-macrobenchmark-typo-fix -> origin/CareF-macrobenchmark-typo-fix
git: c0d537ad3..311ad4bde dart_development_service -> origin/dart_development_service
git: 456d80b9d..2f7a59a8d dev -> origin/dev
git: 5f21edf8b..b041144f8 flutter-1.17-candidate.3 -> origin/flutter-1.17-candidate.3
git: * [new branch] flutter-1.19-candidate.2 -> origin/flutter-1.19-candidate.2
git: * [new branch] flutter-1.19-candidate.3 -> origin/flutter-1.19-candidate.3
git: * [new branch] flutter-1.19-candidate.4 -> origin/flutter-1.19-candidate.4
git: eacd1c8de..746749244 master -> origin/master
git: * [new tag] 1.17.3 -> 1.17.3
git: * [new tag] 1.19.0-2.0.pre -> 1.19.0-2.0.pre
git: * [new tag] 1.19.0-3.0.pre -> 1.19.0-3.0.pre
git: * [new tag] 1.19.0-4.0.pre -> 1.19.0-4.0.pre
git: Switched to a new branch 'beta'
git: Branch 'beta' set up to track remote branch 'beta' from 'origin'.
Successfully switched to flutter channel 'beta'.
To ensure that you're on the latest build from this channel, run 'flutter
upgrade'
接下来,我输入这个。
flutter upgrade
然后,我明白了。
Downloading Dart SDK from Flutter engine ef9215ceb2884ddf520d321bcd822d1461330876...
mv: cannot move '/home/kazu/development/flutter/bin/cache/dart-sdk' to
'/home/kazu/development/flutter/bin/cache/dart-sdk.old': Permission denied
所以,我读了这篇笔记。https://flutter.dev/docs/get-started/web#set-up
The flutter upgrade command silently fails when origin points to a personal fork.
To validate that origin points to https://github.com/flutter/flutter.git,
run the following commands in the root directory of your local copy of the
https://github.com/flutter/flutter repository:
然后,我输入了这个。
cd ~/development/flutter/
git remote get-url origin
然后我的终端返回了这个。
https://github.com/flutter/flutter.git
于是,我又试了一次。
flutter upgrade
我得到了同样的结果。
Downloading Dart SDK from Flutter engine ef9215ceb2884ddf520d321bcd822d1461330876...
mv: cannot move '/home/kazu/development/flutter/bin/cache/dart-sdk' to
'/home/kazu/development/flutter/bin/cache/dart-sdk.old': Permission denied
接下来,我尝试了sudo
sudo flutter upgrade
然后我得到了这个。
sudo: flutter: command not found
你能给我什么建议吗?
解决方案
dart-sdk
对我来说,您遇到的问题是当前用户在文件夹中没有权限。您需要重新检查权限或dart-sdk
文件夹。
示例运行ls -la
查看详细信息
drwxr-xr-x 10 user-xxx staff 320 6 Jun 10:18 dart-sdk
如果不是当前用户,sudo chown
则用于更改dart-sdk
文件夹的所有者。
再试flutter upgrade
一次。
更新解决方案:(参考:github.com/flutter/flutter/issues/17898)
- 手动将 dart-sdk 重命名为其他可以解决问题的名称。
git clean -xffd git pull flutter doctor
或在颤振升级之前运行此命令
推荐阅读
- ios - NSFetchedResultsController 填充和更改 UITableView 行和部分时出错
- c# - 如何使用 C# 解决 InDesign 2020 COM 上的 0x80004002 错误?
- javascript - 我怎样才能知道特定元素的所有数据属性的长度?
- r - 将聚集在一个变量中的数据拆分为R中的多个变量
- spring - 如何使用 spring data couchbase 获取用于文档创建/删除的 couchbase db 事件
- python - 如何根据python中的索引更改字符串
- python - 对列表 Pt 的数据框列中的每个元素运行一个函数。2
- typescript - 尽管如文档所示,为 .env 设置 ConfigModule 仍不起作用
- azure-functions - Azure 函数无法处理二进制 Azure Servicebus 消息
- c++ - 成员函数的 C++ 'this' 参数
有类型'const ',但函数未标记为 const