Flutter: “packages pub”不释放颤振锁

创建于 2018-02-14  ·  3评论  ·  资料来源: flutter/flutter

当运行flutter packages pub run build_runner watch以生成模型类并根据我所做的更改使生成的代码保持最新时。 我无法构建或安装或热重新加载我正在处理的项目。
当我按下 intellij 中的运行按钮来编译和安装应用程序时,出现以下错误:

Waiting for another flutter command to release the startup lock...

当我终止 build_runner 进程时,它开始编译和安装项目。

如果我在项目已经在设备或模拟器/模拟器上运行时启动 build_runner 监视
更改代码时出现以下错误:

Initializing hot reload...
Your application could not be compiled, because its dependencies could not be established.
The following Dart file:
  /Users/user/projects/project/lib/value_models/models.dart
...refers, in an import, to the following library:
  /Users/user/projects/project/lib/value_models/models.g.dart
Unfortunately, that library does not appear to exist on your file system.

有没有办法为代码生成启动一个单独的过程,以便我们可以在开发过程中继续编译和运行我们的应用程序?

easy fix tool

最有用的评论

我们需要在运行 pub 之前释放锁。

所有3条评论

@aegis123我也遇到过这个问题。

作为一种解决方法,您可以设置FLUTTER_ROOT ,然后您可以同时使用flutter runpub run build_runner watch (不带颤振前缀)

我们需要在运行 pub 之前释放锁。

@lfkdsk解决了这个问题! 谢谢!

此页面是否有帮助?
0 / 5 - 0 等级