Pub command is not found after installing dart-sdk

Sometimes when you install dart, you may also have a problem where the dart command works but the pub command does not work, this is because dart is only present in the /usr/bin, to solve this simply make a symlink and to add pub command to this /usr/bin directory.

sudo ln -s /usr/lib/dart/bin/pub /usr/bin/pub

Hope this helps


As someone mentioned in a comment to an (outdated) answer, the nowadays (due to Dart being supplied / integrated with / in Flutter now) suggested correct use of pub is to be called via the flutter command:

`flutter pub`

ie. to use gRPC / protobufs v3 w/ Dart / Flutter:

`flutter pub global activate protoc_plugin`

Tags:

Ubuntu

Path

Dart