无法使用bower下载three.js文件

时间:2015-02-03 05:24:46

标签: javascript git three.js bower bower-install

当我尝试通过在bower.json文件中指定版本来下载three.js文件时出现错误。

 "dependencies": {
                 "three.js":"~0.0.69"
                }
  

错误:在git中找不到任何版本://github.com/jiyinyiyong/three.js.git

相反,我通过指定这样的URL来下载整个仓库:

  "dependencies": {
                      "three.js":"https://github.com/mrdoob/three.js.git"
                    }

这需要时间和空间。 如何只从git repo下载文件?

3 个答案:

答案 0 :(得分:4)

摆脱three.js中的句号,即

"dependencies": {
  "threejs": "r70"
}

这指向官方的ThreeJS存储库。

如果您希望只拥有缩小的库文件(更小的下载),请使用:

"dependencies": {
  "threejs": "https://raw.githubusercontent.com/mrdoob/three.js/master/build/three.min.js"
}

答案 1 :(得分:2)

只需在终端中运行bower install three.js 三个将被安装到: ... / bower_components / three.js

答案 2 :(得分:1)

在凉亭注册处注册的three.js包指向https://github.com/jiyinyiyong/three.js,这不是three.js的官方回购。此存储库仅包含2个.js文件:three.jsthree.min.js 凉亭没有看到任何版本的原因是因为这个存储库不包含任何标签(凉亭用于版本)。最新版本在master分支中。如果要从主分支安装最新版本,则应将依赖关系定义为:

"dependencies": {
    "three.js": "master"
}

请注意,取决于某个分支会有一些缺点,因为它可能会在未来发生变化(也可能会发生变化)。