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

I am trying to set up a Dart project to use shelf. Now to enable hot reload, I am trying to install dartman. On doing

pub global activate dartman

Command 'pub' not found, did you mean:

The I try

dart pub global activate dartman

and I get Error: Error when reading 'pub': No such file or directory

How do I solve this problem?



Solution 1:[1]

This can happen when you have installed Dart-sdk two times. One time as a windows installer, and the other through chocolatey for instance. Uninstall the one you have in "Add/Remove programs", or at least make sure you only have one, and it should work.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 John