【发布时间】:2015-08-30 04:59:13
【问题描述】:
您好,我一直在尝试按照http://www.scala-sbt.org/0.13/tutorial/Manual-Installation.html 的说明在 Mac 上安装 SBT
但是我被困在第一步:
将 sbt-launch.jar 放入 ~/bin。
然后我尝试通过 brew 安装它,安装过程顺利。但是当我检查 sbt 版本以确认安装时。我收到一条新的错误消息:
vtmbpr:~ VT$ brew install sbt
Warning: You are using OS X 10.11.
We do not provide support for this pre-release version.
You may encounter build failures or other breakage.
==> Downloading https://dl.bintray.com/sbt/native-packages/sbt/0.13.9/sbt-0.13.9.tgz
######################################################################## 100.0%
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/sbt
Target /usr/local/bin/sbt
already exists. You may want to remove it:
rm '/usr/local/bin/sbt'
To force the link and overwrite all conflicting files:
brew link --overwrite sbt
To list all files that would be deleted:
brew link --overwrite --dry-run sbt
Possible conflicting files are:
/usr/local/bin/sbt
==> Caveats
You can use $SBT_OPTS to pass additional JVM options to SBT:
SBT_OPTS="-XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"
This formula is now using the standard typesafe sbt launcher script.
Project specific options should be placed in .sbtopts in the root of your project.
Global settings should be placed in /usr/local/etc/sbtopts
==> Summary
???? /usr/local/Cellar/sbt/0.13.9: 5 files, 1.2M, built in 7 seconds
vtmbpr:~ VT$ sbt
Error: Unable to access jarfile /usr/local/bin/sbt-launcher.jar
vtmbpr:~ VT$ $ sbt
-bash: $: command not found
vtmbpr:~ VT$ sbt --version
Error: Unable to access jarfile /usr/local/bin/sbt-launcher.jar
vtmbpr:~ VT$
对于每个人来说,这可能是一个非常简单的问题,但即使是在 coursera 课程的“获取我的工具设置”阶段卡住了 3 个小时的谷歌学习,这也是令人难以置信的沮丧。
更新为通过 brew 删除和重新安装。我怎么知道 sbt 之后是否运行正常?我尝试运行 sbt --version 但抛出了一系列错误。
vtmbpr:~ VT$ sudo rm /usr/local/bin/sbt
Password:
vtmbpr:~ VT$ port install sbt
-bash: port: command not found
vtmbpr:~ VT$ brew install sbt
Warning: sbt-0.13.9 already installed, it's just not migrated
Warning: You are using OS X 10.11.
We do not provide support for this pre-release version.
You may encounter build failures or other breakage.
vtmbpr:~ VT$ sbt
-bash: /usr/local/bin/sbt: No such file or directory
vtmbpr:~ VT$ sbt
-bash: /usr/local/bin/sbt: No such file or directory
vtmbpr:~ VT$ sbt --version
-bash: /usr/local/bin/sbt: No such file or directory
vtmbpr:~ VT$ brew link --overwrite sbt
Linking /usr/local/Cellar/sbt/0.13.9... 1 symlinks created
vtmbpr:~ VT$ sbt
s[info] Set current project to vt (in build file:/Users/VT/)
^R
> sbt --version
[error] Expected ID character
[error] Not a valid command: sbt (similar: set, boot, last)
[error] Expected project ID
[error] Expected configuration
[error] Expected ':' (if selecting a configuration)
[error] Expected key
[error] Not a valid key: sbt (similar: test, ivy-sbt, state)
[error] sbt --version
[error] ^
【问题讨论】:
-
您已将其安装到
/usr/local/bin,而不是~/bin。 -
如何找到~/bin 目录?
-
它可能不存在,您需要创建它。您可以将其保留在当前位置,因为问题看起来像
sbt-launcher.jar的符号链接不正确。 -
请原谅我的基本问题,但 ~ 在我的目录中是什么意思?如果我将 sat-launcher.jar 保留在现在的位置,我该如何引导终端去那里找到它? - 如果我正确理解符号链接。
-
波浪号
~/后跟正斜杠是用户主目录的缩写。