How to install pub (command line usage) for Dart on Ubuntu web-server

后端 未结 5 446
野的像风
野的像风 2021-02-04 01:49

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

5条回答
  •  猫巷女王i
    2021-02-04 01:50

    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 to pub, you can install dart with your .deb installation file, and open the synaptic 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 on dart. Click on properties. Go to the installed files tab. Look for pub to see where it's installed. Here's where mine is: /usr/lib/dart/bin/pub. The 'included files' tab while using gdebi 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 add pub to your path:

    sudo update-alternatives --install /usr/bin/pub pub /usr/lib/dart/bin/pub 0
    

    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):

    update-alternatives --config pub
    

    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 type pub. If it is assigned to something else, the 0 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.

提交回复
热议问题