skip to Main Content

I would like to build a web application with Flutter. I followed this instruction. https://flutter.dev/docs/get-started/web
I use Windows 10, Windows Subsystems for Linux, Debian 10.

I installed Flutter SDK in ~/development/ directory and have already set the path.

I input this.

flutter channel beta

And get this result.

Switching to flutter channel 'beta'...
git: From https://github.com/flutter/flutter
git:    5f21edf8b..b041144f8  stable         -> origin/stable
git:  * [new branch]          CareF-macrobenchmark-typo-fix -> origin/CareF-macrobenchmark-typo-fix
git:    c0d537ad3..311ad4bde  dart_development_service -> origin/dart_development_service
git:    456d80b9d..2f7a59a8d  dev            -> origin/dev
git:    5f21edf8b..b041144f8  flutter-1.17-candidate.3 -> origin/flutter-1.17-candidate.3
git:  * [new branch]          flutter-1.19-candidate.2 -> origin/flutter-1.19-candidate.2
git:  * [new branch]          flutter-1.19-candidate.3 -> origin/flutter-1.19-candidate.3
git:  * [new branch]          flutter-1.19-candidate.4 -> origin/flutter-1.19-candidate.4
git:    eacd1c8de..746749244  master         -> origin/master
git:  * [new tag]             1.17.3         -> 1.17.3
git:  * [new tag]             1.19.0-2.0.pre -> 1.19.0-2.0.pre
git:  * [new tag]             1.19.0-3.0.pre -> 1.19.0-3.0.pre
git:  * [new tag]             1.19.0-4.0.pre -> 1.19.0-4.0.pre
git: Switched to a new branch 'beta'
git: Branch 'beta' set up to track remote branch 'beta' from 'origin'.
Successfully switched to flutter channel 'beta'.
To ensure that you're on the latest build from this channel, run 'flutter
upgrade'

Next, I input this.

flutter upgrade

Then, I get this.

Downloading Dart SDK from Flutter engine ef9215ceb2884ddf520d321bcd822d1461330876...
mv: cannot move '/home/kazu/development/flutter/bin/cache/dart-sdk' to
'/home/kazu/development/flutter/bin/cache/dart-sdk.old': Permission denied

So, I read this NOTE. https://flutter.dev/docs/get-started/web#set-up

The flutter upgrade command silently fails when origin points to a personal fork. 
To validate that origin points to https://github.com/flutter/flutter.git, 
run the following commands in the root directory of your local copy of the 
https://github.com/flutter/flutter repository:

Then, I input this.

cd ~/development/flutter/
git remote get-url origin

Then my terminal returned this.

https://github.com/flutter/flutter.git

So, I tried again.

flutter upgrade

I got the same result.

Downloading Dart SDK from Flutter engine ef9215ceb2884ddf520d321bcd822d1461330876...
mv: cannot move '/home/kazu/development/flutter/bin/cache/dart-sdk' to
'/home/kazu/development/flutter/bin/cache/dart-sdk.old': Permission denied

Next, I tried sudo

sudo flutter upgrade

Then I got this.

sudo: flutter: command not found

Could you give me any advice please?

2

Answers


  1. For me, The problem you got is the current user not have permission in dart-sdk folder. You need to re-check the permission or dart-sdk folder.

    Example
    run ls -la to see the details

    drwxr-xr-x 10 user-xxx staff 320 6 Jun 10:18 dart-sdk

    If not current user, using sudo chown to change owner of dart-sdk folder.

    try flutter upgrade again.

    Update
    Solution: (ref: github.com/flutter/flutter/issues/17898)

    • Manually rename dart-sdk to something else resolved the problem.
    • or run this command git clean -xffd git pull flutter doctor before flutter upgrade
    Login or Signup to reply.
  2. When you are trying to call some flutter command and have such output:

    Downloading Dart SDK from Flutter engine 40441def692f444660a11e20fac37af9050245ab...
    mv: rename /Library/Flutter/bin/cache/dart-sdk
    to /Library/Flutter/bin/cache/dart-sdk.old: Permission denied
    

    it means you do not have sufficient permissions or the file belongs to another user.

    What to do?

    1) Go to provided directory with this to the file.

    cd /Library/Flutter/bin/cache/
    

    2) Check who is the owner
    By listing all of the files:

    ls -l
    

    with output:
    enter image description here

    3) Change owner of this file to you

    sudo chown -R $USER dart-sdk
    

    provide password (needed by sudo) and click Enter

    4) Check again who is the owner

    file owner should be set for your current user

    5) Repeat your flutter command

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search