首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >颤动升级出现错误,未升级到最新版本

颤动升级出现错误,未升级到最新版本
EN

Stack Overflow用户
提问于 2019-03-19 10:37:46
回答 2查看 4.4K关注 0票数 1

升级Flutter SDK和软件包

代码语言:javascript
复制
    My-Mac:~ admin$ flutter upgrade

    Upgrading Flutter from /Users/admin/Desktop/SDK/flutter...
    error: Your local changes to the following files would be overwritten by merge:
        packages/flutter/lib/src/services/message_codecs.dart
    Please commit your changes or stash them before you merge.
    Aborting
    Updating 2eeeXXXe9..7XXXbf4aX

我访问了flutter SDK并查看了status,得到了以下内容

代码语言:javascript
复制
My-Mac:flutter admin$  git status
On branch master
Your branch is behind 'origin/master' by 565 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
modified:   dev/automated_tests/pubspec.yaml
modified:   dev/benchmarks/complex_layout/pubspec.yaml
modified:   dev/benchmarks/macrobenchmarks/pubspec.yaml
modified:   dev/benchmarks/microbenchmarks/pubspec.yaml
modified:   dev/bots/pubspec.yaml
modified:   dev/devicelab/pubspec.yaml
modified:   dev/integration_tests/android_semantics_testing/pubspec.yaml
modified:   dev/integration_tests/android_views/pubspec.yaml
modified:   dev/integration_tests/channels/pubspec.yaml
modified:   dev/integration_tests/external_ui/pubspec.yaml
modified:   dev/integration_tests/flavors/pubspec.yaml
modified:   dev/integration_tests/platform_interaction/pubspec.yaml
modified:   dev/integration_tests/ui/pubspec.yaml
modified:   dev/manual_tests/pubspec.yaml
modified:   dev/snippets/pubspec.yaml
modified:   dev/tools/pubspec.yaml
modified:   dev/tools/vitool/pubspec.yaml
modified:   examples/catalog/pubspec.yaml
modified:   examples/flutter_gallery/pubspec.yaml
modified:   examples/hello_world/pubspec.yaml
modified:   examples/layers/pubspec.yaml
modified:   examples/platform_channel/pubspec.yaml
modified:   examples/platform_channel_swift/pubspec.yaml
modified:   examples/stocks/pubspec.yaml
modified:   packages/flutter/lib/src/services/message_codecs.dart
modified:   packages/flutter/pubspec.yaml
modified:   packages/flutter_driver/pubspec.yaml
modified:   packages/flutter_goldens/pubspec.yaml
modified:   packages/flutter_localizations/pubspec.yaml
modified:   packages/flutter_test/pubspec.yaml
modified:   packages/flutter_tools/pubspec.yaml
modified:   packages/fuchsia_remote_debug_protocol/pubspec.yaml

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    OLDSDK.zip

no changes added to commit (use "git add" and/or "git commit -a")

在完成上述任务后,现在尝试再次升级颤动,但再次得到下面提到的错误

代码语言:javascript
复制
My-Mac:flutter admin$ flutter upgrade
    Building flutter tool...
    Because flutter_tools depends on sockjs_client 0.3.5 which doesn't match any versions, version solving failed.
    Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)
    .
    .
    Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (1 tries left)
    Command 'pub upgrade' still failed after 10 tries, giving up.
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-03-19 11:13:13

Flutter使用git进行SDK管理。您需要检查位于$HOME/development/flutter中的存储库。你可以使用git命令来检查你的repostory状态。例如,

代码语言:javascript
复制
$ git status

查看您的本地更改

代码语言:javascript
复制
$ git branch

查看您使用的是哪个分支。

下面的步骤可能会帮助你,当你发现你已经更改了一些未提交的东西,但你想要撤消所有更改,只需切换到最新版本(master)。

代码语言:javascript
复制
$ git reset --hard HEAD

撤消您所做的所有更改。

代码语言:javascript
复制
$ git checkout master

切换到主分支

代码语言:javascript
复制
$ git pull

下拉并同步服务器上的所有提交。

票数 2
EN

Stack Overflow用户

发布于 2019-03-19 11:05:12

您可能不小心编辑了颤动代码。

要修复它,请转到flutter文件夹,它应该是/Users/admin/Desktop/SDK/flutter

并通过运行以下命令检查任何更改

代码语言:javascript
复制
git status

如果有任何更改,在您的示例中,只需通过以下方式恢复更改packages/flutter/lib/src/services/message_codecs.dart,:

代码语言:javascript
复制
git checkout -- packages/flutter/lib/src/services/message_codecs.dart
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55232835

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档