I've followed the instructions here (under the Linux tab) on installing Dart onto a Ubuntu web-server.
Dart itself works fine, but I can't use Pub commands (only Dart commands). How can I install Pub for the server?
I've followed the instructions here (under the Linux tab) on installing Dart onto a Ubuntu web-server.
Dart itself works fine, but I can't use Pub commands (only Dart commands). How can I install Pub for the server?
Günter Zöchbauer already told you how to get the program (it's apparently already installed by default with
dart
, but just isn't in the path for some reason). To find the path topub
, you can installdart
with your.deb
installation file, and open thesynaptic package manager
(type sudo synaptic from the command-line; install synaptic first, if it's not installed—sudo apt-get install synaptic
), find dart in the Synaptic Package Manager. Right click ondart
. Click onproperties
. Go to theinstalled files
tab. Look forpub
to see where it's installed. Here's where mine is:/usr/lib/dart/bin/pub
. The 'included files' tab while usinggdebi
to open the.deb
file may be insightful as to where it will put it, too.Then type this from the command-line (substituting your path to
pub
if it's not like mine); this will addpub
to your path:You may need to check first to see if
pub
is assigned to something else already (it sounds like you already know that it's not, but it's good to know how to do this for the future, including if you want to change which one is assigned at a particular time):That will let you see what typing
pub
will run, what alternatives are currently configured for that, and allow you to change which program (of the alternatives) will run when you typepub
. If it is assigned to something else, the0
at the end of the first command I mentioned might need to be changed to a different number.Note: There are other programs besides pub in the same directory that you might want to add to your path.
I guess you just need to add the
dart-sdk/bin
directory to the path or alternatively create symlinks in/usr/bin
for the Dart tools you want to have easily available.Here are Dart’s installation instructions for 64bit version of Ubuntu using the Aptitude (apt) package manager (as found on the website):
After this though, it’s likely that the Pub commands will not work in the terminal even if the Dart language does (yours might be different, try entering ‘pub –-help’ to see). If this is the case, Pub can be enabled manually by adding Dart to the ‘.profile’ PATH.
It’s likely that the newly installed Dart files will be located in the ‘/usr/lib/dart’ directory (do check this if unsure). Once known, edit the ‘.profile’ file by entering:
This will edit the bash profile using nano (if installed, else use another command line file editor). Now at the bottom of the file, add:
When finished, you can check it has saved afterwards by entering ‘cat ~/.profile’. Now force the bash profile to reload by entering:
Enter ‘pub –help’ again to check and hopefully the Pub help information is shown. Thank you Günter Zöchbauer for the hint ;)