jenkins 在linux/CentOS7中安装flutter vagrant VM问题[vagrant@localhost ~]$ flutter doctor -v

ymdaylpp  于 2023-08-03  发布在  Jenkins
关注(0)|答案(1)|浏览(115)

请告诉我如何在我的vagrant centos vm ssh中解决这个问题:
(目的:使用vagrant ssh访问在centos7虚拟机上进行flutter web构建和FTP部署的jenkins管道)

  • PS:我用的是flutter 3.7.9稳定版· Dart 2.19.6 · DevTools 2.20.1*

所以,我遇到了这个第一个问题,我能够修复它,但遇到更多的问题后:

[vagrant@localhost ~]$ flutter doctor -v
Flutter failed to write to a file at "/opt/flutter/version".
Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current
user.
Try running:
  sudo chown -R $(whoami) /opt/flutter/version


#0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1      _throwFileSystemException (package:flutter_tools/src/base/error_handling_io.dart:840:3)
#2      _handlePosixException (package:flutter_tools/src/base/error_handling_io.dart:767:3)
#3      _runSync (package:flutter_tools/src/base/error_handling_io.dart:610:7)
#4      ErrorHandlingFile.writeAsStringSync (package:flutter_tools/src/base/error_handling_io.dart:270:5)
#5      FlutterVersion.ensureVersionFile (package:flutter_tools/src/version.dart:169:74)
#6      FlutterCommandRunner.runCommand.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command_runner.dart:244:32)
<asynchronous suspension>
#7      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#8      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#9      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:9)
<asynchronous suspension>
#10     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#11     main (package:flutter_tools/executable.dart:91:3)
<asynchronous suspension>
[vagrant@localhost ~]$

字符串
所以这似乎与我的Vagrant CentOS VM中Flutter的文件权限有关。错误消息表明Flutter未能写入位于“/opt/flutter/version”的文件,并建议使用“sudo chown”将目录的所有权更改为当前用户。
为了解决这个问题,我确实遵循了错误消息中给出的建议,并运行了建议的命令来更改“/opt/flutter”目录的所有权:

sudo chown -R $(whoami) /opt/flutter


所以,这个命令将递归地更改所有文件和子目录中的所有权“/opt/flutter”到当前登录的用户,授予您读/写权限.
运行命令后,我可以通过检查“/opt/flutter/version”文件的权限并确保用户可以访问它来验证更改的所有权。为此,我运行了以下命令:

ls -l /opt/flutter/version


因此,我应该看到文件的所有者被列为我的当前用户,并且权限应该允许所有者进行读写访问。
一旦我修复了权限,我试着再次运行“flutter doctor -v”命令,看看问题是否已经解决,它被正确解决了。
现在我在运行flutter doctor -v时遇到了一个新问题:
我尝试了flutter文档中的这些命令(https://docs.flutter.dev/get-started/install/linux#additional-linux-requirements),但我在CentOS中没有apt-get包,我只有yum install...等
我需要有关此命令以及如何在centos 7上运行它的帮助:
sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev

[vagrant@localhost ~]$ flutter doctor -v
Running "flutter pub get" in flutter_tools...
Resolving dependencies in ../../opt/flutter/packages/flutter_tools... (4.1s)
  _fe_analyzer_shared 50.0.0 (62.0.0 available)
  analyzer 5.2.0 (6.0.0 available)
  archive 3.3.2 (3.3.7 available)
  args 2.3.1 (2.4.2 available)
  async 2.10.0 (2.11.0 available)
  built_value 8.4.2 (8.6.1 available)
  checked_yaml 2.0.1 (2.0.3 available)
  collection 1.17.0 (1.17.2 available)
  completion 1.0.0 (1.0.1 available)
  coverage 1.6.1 (1.6.3 available)
  crypto 3.0.2 (3.0.3 available)
  csslib 0.17.2 (1.0.0 available)
  dds 2.5.0 (2.9.2 available)
  dds_service_extensions 1.3.1 (1.6.0 available)
  devtools_shared 2.18.0 (2.25.0 available)
  dwds 16.0.2+1 (19.0.2 available)
  file 6.1.4 (7.0.0 available)
  fixnum 1.0.1 (1.1.0 available)
  frontend_server_client 3.1.0 (3.2.0 available)
  glob 2.1.1 (2.1.2 available)
  html 0.15.1 (0.15.4 available)
  http 0.13.5 (1.1.0 available)
  intl 0.17.0 (0.18.1 available)
  io 1.0.3 (1.0.4 available)
  js 0.6.5 (0.6.7 available)
  json_annotation 4.7.0 (4.8.1 available)
  logging 1.1.0 (1.2.0 available)
  matcher 0.12.13 (0.12.16 available)
  meta 1.8.0 (1.9.1 available)
  mime 1.0.2 (1.0.4 available)
  multicast_dns 0.3.2+2 (0.3.2+3 available)
  native_stack_traces 0.5.2 (0.5.6 available)
  node_preamble 2.0.1 (2.0.2 available)
  path 1.8.2 (1.8.3 available)
  petitparser 5.1.0 (5.4.0 available)
  pub_semver 2.1.3 (2.1.4 available)
  pubspec_parse 1.2.1 (1.2.3 available)
  shelf 1.4.0 (1.4.1 available)
  shelf_packages_handler 3.0.1 (3.0.2 available)
  shelf_proxy 1.0.2 (1.0.4 available)
  shelf_static 1.1.1 (1.1.2 available)
  shelf_web_socket 1.0.3 (1.0.4 available)
  source_maps 0.10.11 (0.10.12 available)
  source_span 1.9.1 (1.10.0 available)
  sse 4.1.1 (4.1.2 available)
  stack_trace 1.11.0 (1.11.1 available)
  stream_channel 2.1.1 (2.1.2 available)
  test 1.22.0 (1.24.4 available)
  test_api 0.4.16 (0.6.1 available)
  test_core 0.4.20 (0.5.4 available)
  typed_data 1.3.1 (1.3.2 available)
  usage 4.1.0 (4.1.1 available)
  vm_service 9.4.0 (11.8.0 available)
  vm_snapshot_analysis 0.7.2 (0.7.6 available)
  watcher 1.0.2 (1.1.0 available)
  web_socket_channel 2.2.0 (2.4.0 available)
  webdriver 3.0.1 (3.0.2 available)
  xml 6.2.2 (6.3.0 available)
  yaml 3.1.1 (3.1.2 available)
Got dependencies in ../../opt/flutter/packages/flutter_tools!
[✓] Flutter (Channel stable, 3.7.9, on CentOS Linux 7 (Core) 3.10.0-1160.92.1.el7.x86_64, locale en_US.UTF-8)
    • Flutter version 3.7.9 on channel stable at /opt/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 62bd79521d (4 months ago), 2023-03-30 10:59:36 -0700
    • Engine revision ec975089ac
    • Dart version 2.19.6
    • DevTools version 2.20.1

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✗] Linux toolchain - develop for Linux desktop
    • clang version 3.4.2 (tags/RELEASE_34/dot2-final)
    • cmake version 2.8.12.2
    ✗ cmake 3.10.0 or later is required.
    ✗ ninja is required for Linux development.
      It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from
      https://github.com/ninja-build/ninja/releases
    • pkg-config version 0.27.1
    ✗ pkg-config 0.29.0 or later is required.

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] Connected device (1 available)
    • Linux (desktop) • linux • linux-x64 • CentOS Linux 7 (Core) 3.10.0-1160.92.1.el7.x86_64

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 4 categories.

[vagrant@localhost ~]$


我试着自己解决但我做不到所以我需要帮助

vptzau2j

vptzau2j1#

第一:

sudo yum update

字符串
EPEL(Extra Packages for Enterprise Linux)存储库提供了默认CentOS存储库中不可用的其他包。要安装它,请运行:

sudo yum install epel-release


你可以尝试这个命令,但我怀疑它会给予你你需要的特定版本:

sudo yum install clang cmake ninja-build pkgconfig gtk3-devel xz-devel
sudo yum install python-pip

的字符串
检查版本:

pip --version


对于版本3:

sudo yum install python3


检查版本:

python3 --version


https://pypi.org/project/cmake/3.11.0/

pip install cmake==3.11.0


对于其他/更高版本,请检查此链接,然后单击您喜欢的任何版本,您将看到pip安装命令(只需复制:https://pypi.org/project/cmake/#history
安装pkgconfig:

pip install pkgconfig==1.1.0


你可以在这里找到更多信息:https://pypi.org/project/pkgconfig/1.1.0/
版本检查:

pkg-config --version


如果您遇到pip版本问题,请使用以下命令进行升级:

pip install --upgrade pip


或者是

sudo yum install python3-pip
pip3 --version

然后重复 pkg-config 安装命令
安装GTK 3.0开发库:

sudo yum install gtk3-devel

相关问题