Home > Back-end >  Receiving an error when trying to run pub
Receiving an error when trying to run pub

Time:10-19

In VSCode and trying to run the following:

dart pub upgrade

I get the following error:

Error: Error when reading 'pub': No such file or directory

However, my flutter file seems fine. Flutter Doctor output below:

[✓] Flutter (Channel stable, 3.3.4, on macOS 12.6 21G115 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.72.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

Any idea how I can resolve this? Thanks!

CodePudding user response:

try creating a .bashrc file in your user's folder.

Then add the following:

PATH=$PATH:/path/to/dart/installation/bin/folder
export PATH

CodePudding user response:

first clean dart using dart pub cache clean

then run dart pub get

After that run dart pub get upgrade

  • Related