1

Please let me know how to fix this in my vagrant centos vm ssh :

(purpose : jenkins pipeline for flutter web build and FTP deployment on centos7 virtual machine using vagrant ssh access)

PS: I'm using flutter version 3.7.9 stable • Dart 2.19.6 • DevTools 2.20.1

so, I ran into this first issue I was able to fix it but after ran into more issues :

[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 ~]$

So this seems to be related to file permissions for Flutter in my Vagrant CentOS VM. The error message indicates that Flutter failed to write to a file at "/opt/flutter/version" and suggests using "sudo chown" to change the ownership of the directory to the current user.

To fix this issue, I did follow the advice given in the error message and ran the suggested command to change ownership of the "/opt/flutter" directory:

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

So, This command will recursively change the ownership of all files and subdirectories inside "/opt/flutter" to the currently logged-in user, granting you read/write permissions.

After running the command, I could verify the ownership that has been changed by checking the permissions of the "/opt/flutter/version" file and ensuring it's accessible for your user. To do this, I ran the following command:

ls -l /opt/flutter/version

So, I should see the owner of the file listed as my current user, and the permissions should allow read and write access for the owner.

Once I have fixed the permissions, I tried running the "flutter doctor -v" command again to see if the issue has been resolved, and It was solved correctly ✅.

Now I got a new issue when running flutter doctor -v :

I tried these commands from the flutter documentation (https://docs.flutter.dev/get-started/install/linux#additional-linux-requirements) but I didn't have apt-get package in CentOS, I have only yum install....etc

I need help with this command and how to run it on 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 ~]$

I tried on my own to fix this but I couldn't that's why I need help

1 Answer 1

0

First :

sudo yum update

The EPEL (Extra Packages for Enterprise Linux) repository provides additional packages not available in the default CentOS repositories. To install it, run:

sudo yum install epel-release

you can try this command but I doubt it would give you specific version for what you need :

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

to check the version:

pip --version

for version 3 :

sudo yum install python3

to check the version :

python3 --version

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

pip install cmake==3.11.0

for other / higher versions check this link then click any version you like and you will see the pip installation command (just copy : https://pypi.org/project/cmake/#history

Install pkgconfig :

pip install pkgconfig==1.1.0

You can find more info here : https://pypi.org/project/pkgconfig/1.1.0/

version check :

pkg-config --version

if you ran into pip version issues, use this to upgrade :

pip install --upgrade pip

or

sudo yum install python3-pip
pip3 --version

then repeat the pkg-config installation command

Install GTK 3.0 development libraries:

sudo yum install gtk3-devel
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.