Search code examples
flutter

Insufficient permissions to the resource in https://pub.dartlang.org package repository


I got this error when I delete flutter-sdk and replace new flutter-sdk

Insufficient permissions to the resource in https://pub.dartlang.org package repository. You can modify credential using:
    pub token add https://pub.dartlang.org
Running "flutter pub get" in flutter_tools...                           
pub get failed (65;     pub token add https://pub.dartlang.org)

flutter version :

Flutter 2.8.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision cf44000065 (6 days ago) • 2021-12-08 14:06:50 -0800
Engine • revision 40a99c5951
Tools • Dart 2.15.0

Solution

  • First delete credentials:

    rm ~/.pub-cache/credentials.json
    

    After you try:

    flutter upgrade
    flutter pub cache repair