如何使用bower在javascript项目中包含私有本地文件

cod*_*ode 17 javascript bower

我想将自定义文件包含为bower依赖项之一.

我有以下bower.json

{
  "name": "xyz",
  "version": "0.0.0",
  "dependencies": {
    "sass-bootstrap": "~2.3.0",
    "requirejs": "~2.1.4",
    "modernizr": "~2.6.2",
    "jquery": "~1.9.1",
    "beautify": "file:/path/to/beautify.js"
  },

  "devDependencies": {}
}
Run Code Online (Sandbox Code Playgroud)

但是当我做bower安装它会给出错误:

 bower beautify#*             ENOTFOUND Package file:/path/to/beautify.js not found
Run Code Online (Sandbox Code Playgroud)

但是当我在浏览器中打开相同的路径时,我得到了正确的文件.我还检查了路径的区分大小写.

现在可以告诉我我在做什么错误吗?语法有什么问题吗?

还告诉我如果我想添加相同的通过凉亭缓存.全球凉亭缓存存储在mac中的位置?我们如何注册私有包的url,以便我只需要将包的名称放入bower.json并且bower从缓存中找到文件?

小智 17

下面的代码对我在Ubuntu上使用Bower 1.2.8不起作用.

"beautify": "/path/to/beautify.js"

工作用了什么:"beautify": "./path/to/beautify.js".这样,路径指向bower.json所在目录的相对文件.


She*_*eng 5

它应该只是/relative/path/to/beautify.js.没有文件:/'.

"beautify": "/path/to/beautify.js"
Run Code Online (Sandbox Code Playgroud)