dart - dart pub 全局包在 Windows 10 上运行两次
解决方案
我找到的解决方案是编辑 .bat 文件
C:\Users\$Username\AppData\Local\Pub\Cache\bin
原始bat文件
@echo off
rem This file was created by pub v2.13.4.
rem Package: dart_clean
rem Version: 0.1.3
rem Executable: dart_clean
rem Script: main
if exist "C:\Users\EBrain\AppData\Local\Pub\Cache\global_packages\dart_clean\bin\main.dart-2. 13.4.snapshot" (
dart "C:\Users\EBrain\AppData\Local\Pub\Cache\global_packages\dart_clean\bin\main.dart-2.13.4.snapshot" %*
rem The VM exits with code 253 if the snapshot version is out-of-date.
rem If it is, we need to delete it and run "pub global" manually.
if not errorlevel 253 (
goto error
)
pub global run dart_clean:main %*
) else (
pub global run dart_clean:main %*
)
goto eof
:error
exit /b %errorlevel%
:eof
修改过的bat文件
@echo off
rem This file was created by pub v2.13.4.
rem Package: dart_clean
rem Version: 0.1.3
rem Executable: dart_clean
rem Script: main
pub global run dart_clean:main %*
goto eof
:error
exit /b %errorlevel%
:eof
但是每次更新包或激活新包时,我都必须回去编辑bat文件,这真的很不方便。
有任何合法的方法可以防止 pub 全局包运行两次。
推荐阅读
- git - 如何在 GitHub Action 中将 git diff 保存为数组
- javascript - 在 Google HtmlService 中使用 ToggleButton 的值
- angular - 进入定义它的页面时如何调整组件内的mapbox地图的大小?
- mysql - 使用 MySQL 在 JDBC 中运行大量 SELECT 查询的最快方法是什么?
- python - 如何使用 Kivy 将所选图像放置在 BoxLayout 中
- python - 如何在 python matplotlib 中使用 loglog 绘制最佳拟合线
- xmlhttprequest - 对 mDNS URL 的 HTTP 查询有效,XHR 无效
- flutter - 空相关错误 - 参数类型“字符串?函数(字符串)'不能分配给参数类型'字符串?函数(字符串?)?
- macos - 如何在 VS Code 中启动由 ninja 构建的基于 Cocoa 的 macOS 应用程序?
- integer - 我们如何理解在 Julia 中将十六进制数与十进制数相加?