如何在Ubuntu Web服务器上为Dart安装pub(命令行用法) [英] How to install pub (command line usage) for Dart on Ubuntu web-server

查看:127
本文介绍了如何在Ubuntu Web服务器上为Dart安装pub(命令行用法)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按照此处(在Linux标签下),将Dart安装到Ubuntu网络服务器上。

I've followed the instructions here (under the Linux tab) on installing Dart onto a Ubuntu web-server.

Dart本身可以正常工作,但我不能使用Pub命令(仅Dart命令)。如何为服务器安装Pub?

Dart itself works fine, but I can't use Pub commands (only Dart commands). How can I install Pub for the server?

推荐答案

以下是Dart使用Aptitude的64位版本Ubuntu的安装说明(apt)程序包管理器(在网站上找到):

Here are Dart’s installation instructions for 64bit version of Ubuntu using the Aptitude (apt) package manager (as found on the website):

# Enable HTTPS for apt. 
$ sudo apt-get update 
$ sudo apt-get install apt-transport-https 

# Get the Google Linux package signing key. 
$ sudo sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -' 

# Set up the location of the stable repository.
$ sudo sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list' 
$ sudo apt-get update 
$ sudo apt-get install dart

不过,在此之后,即使Dart语言也无法在终端中使用Pub命令(您可能有所不同,请尝试输入'pub –-help ' 查看)。在这种情况下,可以通过将Dart添加到 .profile路径中来手动启用发布。

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.

新安装的Dart文件很可能位于 / usr / lib / dart目录中(如果不确定,请进行检查)。知道后,通过输入以下内容来编辑 .profile文件:

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:

nano ~/.profile

这将使用nano编辑bash配置文件(如果已安装,则使用其他命令行文件编辑器)。现在,在文件底部,添加:

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:

export PATH="$PATH:/usr/lib/dart/bin"

完成后,您可以输入 cat〜/ .profile来检查它是否已保存。现在,通过输入以下内容来强制重新加载bash配置文件:

When finished, you can check it has saved afterwards by entering ‘cat ~/.profile’. Now force the bash profile to reload by entering:

. ~/.profile

再次输入'pub –help'进行检查,并希望显示Pub帮助信息。谢谢GünterZöchbauer的提示;)

Enter ‘pub –help’ again to check and hopefully the Pub help information is shown. Thank you Günter Zöchbauer for the hint ;)

这篇关于如何在Ubuntu Web服务器上为Dart安装pub(命令行用法)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆