Bower安装不同文件结构的相同包

时间:2015-02-16 15:42:53

标签: javascript gruntjs npm bower yeoman-generator-angular

我们有一个TeamCity构建服务器,运行在具有相同配置的三个不同的构建器上。我们使用yeoman设置了一个角度/咕噜声项目

更新6

添加了凉亭问题 https://github.com/bower/bower/issues/1709

凉亭有时会安装例如角度动画的结构:

bower_components/angular-animate/bower-angular-animate-1.3.13/angular-animate.js

有时它会将bower-angular-animate-1.3.13的内容放在根中,所以结构如下所示:

bower_components/angular-animate/angular-animate.js

第一个让我们的测试失败当然..

有人有线索吗?它总是与获取额外目录的相同包。在本地它总是有效。

更新

似乎当我们运行bower时它没有找到包bower.json中的主要js文件,看起来这可能是问题所在。但我不知道如何解决它。

更新2:

看起来bower并没有找到bower.json中的主键,例如:

[09:27:40]bower angular-animate#1.3.13          invalid-meta angular-animate is missing "main" entry in bower.json
[09:27:40]bower angular-animate#1.3.13          invalid-meta angular-animate is missing "ignore" entry in bower.json

那么什么可能导致找到主要的差异?

更新3:

如果我理解正确,.bower.json文件是由bower在下载和解压缩档案后创建的。现在我注意到.bower.json文件存在差异。在生成的.bower.json文件中,缺少main和ignore。如上所述,档案也被提取出来。

此软件包失败:

[pejn@bx0023 1.3.13]$ more .bower.json
{
    "name": "angular-animate",
    "homepage": "https://github.com/angular/bower-angular-animate",
    "version": "1.3.13",
    "_release": "1.3.13",
    "_resolution": {
        "type": "version",
        "tag": "v1.3.13",
        "commit": "f18cb98590471ad9c1e5ae0e57178e9ecb8d384c"
    },
    "_source": "https://github.com/angular/bower-angular-animate.git",
"_target": "1.3.13"
}

这有效:

[pejn@bx0023 1.3.13]$ more .bower.json
{
    "name": "angular-animate",
    "version": "1.3.13",
    "main": "./angular-animate.js",
    "ignore": [],
    "dependencies": {
            "angular": "1.3.13"
    },
    "homepage": "https://github.com/angular/bower-angular-animate",
    "_release": "1.3.13",
    "_resolution": {
        "type": "version",
        "tag": "v1.3.13",
        "commit": "f18cb98590471ad9c1e5ae0e57178e9ecb8d384c"
    },
    "_source": "https://github.com/angular/bower-angular-animate.git",
    "_target": "1.3.13"
}

更新4:

添加我的bower.json

{
  "name": "App",
  "version": "0.0.1",
  "dependencies": {
    "angular": "1.3.13",
    "json3": "3.3.0",
    "es5-shim": "4.0.0",
    "bootstrap": "3.2.0",
    "angular-animate": "1.3.13",
    "angular-cookies": "1.3.13",
    "angular-resource": "1.3.13",
    "angular-route": "1.3.13",
    "angular-sanitize": "1.3.13",
    "angular-touch": "1.3.13",
    "angular-cache": "3.2.5",
    "modernizr": "2.8.3",
    "jquery": "2.1.3",
    "jquery-ui": "1.11.3",
    "angular-bootstrap": "0.12.0",
    "angular-local-storage": "0.1.5",
    "highstock-release": "2.0.4",
    "moment": "2.9.0",
    "moment-timezone": "0.3.0",
    "angular-ui-sortable": "0.13.3",
    "angular-ui-utils": "bower-unique"
  },
  "devDependencies": {
    "angular-mocks": "1.3.13",
    "angular-scenario": "1.3.13"
  },
  "appPath": "app",
  "resolutions": {
    "angular": "1.3.13"
  }
}

更新5

我在buildserver上运行了bower的测试,因为我看到它看起来像是有代理/权限问题。看起来我们得到了403.我包括以下布尔测试的部分输出:

[18:27:57] [0m  1) UrlResolver .hasNew should resolve to false if cache headers haven't changed:
[18:27:57] [0m [31m     Uncaught Error: expected true to equal false [0m [90m
...
[18:27:57] [0m  2) UrlResolver .hasNew should resolve to true if server responds with 304 (ETag mechanism):
[18:27:57] [0m [31m     Uncaught Error: expected true to equal false [0m [90m
...
[18:27:57] [0m  3) UrlResolver .hasNew should work with redirects:
[18:27:57] [0m [31m     Uncaught Error: expected true to equal false [0m [90m
...
[18:27:57] [0m  4) UrlResolver .resolve should download file, renaming it to index:
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
...
[18:27:57] [0m  5) UrlResolver .resolve should extract if source is an archive:
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
...
[18:27:57] [0m  6) UrlResolver .resolve should extract if source is an archive (case insensitive):
[18:27:57]
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
...
[18:27:57] [0m  7) UrlResolver .resolve should copy extracted folder contents if archive contains only a folder inside:
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
...
[18:27:57] [0m  8) UrlResolver .resolve should extract if source is an archive and rename to index if it's only one file inside:
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
[18:27:57]      at createError (/mnt/ext4/builduser7/build-agent-work-dir/1f8c068934a7bbe0/node_modules/bower/lib/util/createError.js:4:15)
[18:27:57]      at Request.<anonymous> (/mnt/ext4/builduser7/build-agent-work-dir/1f8c068934a7bbe0/node_modules/bower/lib/util/download.js:45:40)
[18:27:57]      at Request.emit (events.js:117:20)
[18:27:57] [33mWarning: Task "simplemocha:full" failed.  Use --force to continue. [39m
[18:27:57]      at Request.onResponse (/mnt/ext4/builduser7/build-agent-work-dir/1f8c068934a7bbe0/node_modules/bower/node_modules/request/request.js:1085:10)
...
[18:27:57] [0m  9) UrlResolver .resolve should extract if source is an archive and not rename to index if inside it's just a just bower.json/component.json file in it:
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
....
[18:27:57] [0m  10) UrlResolver .resolve should rename single file from a single folder to index when source is an archive:
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
....
[18:27:57] [0m  11) UrlResolver .resolve should extract if response content-type is an archive:
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
....
[18:27:57] [0m  12) UrlResolver .resolve should extract if response content-disposition filename is an archive:
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
...
[18:27:57] [0m  13) UrlResolver .resolve should save the release if there's a E-Tag:
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
...
[18:27:57] [0m  14) UrlResolver .resolve should allow for query strings in URL:
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
...
[18:27:57] [0m  15) UrlResolver .resolve should save cache headers:
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
....
[18:27:57] [0m  16) UrlResolver .resolve should work with redirects:
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
....
[18:27:57] [0m  17) UrlResolver .resolve content-disposition validation should work with and without quotes:
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
...
[18:27:57] [0m  18) UrlResolver .resolve content-disposition validation should not work with partial quotes:
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
...
[18:27:57] [0m  19) UrlResolver .resolve content-disposition validation should not work if the filename contain chars other than alphanumerical, dashes, spaces and dots:
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
...
[18:27:57] [0m  20) UrlResolver .resolve content-disposition validation should trim leading and trailing spaces:
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
...
[18:27:57] [0m  21) UrlResolver .resolve content-disposition validation should not work if the filename ends with a dot:
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
...
[18:27:57] [0m  22) UrlResolver .resolve content-disposition validation should be case insensitive:
[18:27:57] [0m [31m     Uncaught Error: Status code of 403 [0m [90m
...
[18:27:57] [0m  23) GitResolver ._cleanup should remove the .git folder from the temp dir:
[18:27:57] [0m [31m     Uncaught Error: ENOENT, lstat '/mnt/ext4/builduser7/build-agent-work-dir/1f8c068934a7bbe0/node_modules/bower/.git' [0m [90m
...
[18:27:57] [0m  24) GitFsResolver .resolve should checkout correctly if resolution is a branch:
[18:27:57] [0m [31m     Uncaught Error: Tag/branch some-branch does not exist [0m [90m
...
[18:27:57] [0m  25) GitFsResolver .resolve should leave the original repository untouched:
[18:27:57] [0m [31m     Uncaught Error: Tag/branch some-branch does not exist [0m [90m
...
[18:27:57] [0m  26) GitFsResolver .resolve should copy source folder permissions:
[18:27:57] [0m [31m     Uncaught Error: Tag/branch some-branch does not exist [0m [90m
...
[18:27:57] [0m  27) GitFsResolver #refs should resolve to the references of the local repository:
[18:27:57]
[18:27:57]       [31mUncaught Error: expected [ '0a7daf646d4fd743b6ef701d63bdbe20eee422de refs/tags/0.0.1',
...
[18:27:57] [0m  28) GitFsResolver #refs should cache the results:
[18:27:57]
[18:27:57]       [31mUncaught Error: expected [ '0a7daf646d4fd743b6ef701d63bdbe20eee422de refs/tags/0.0.1',
...
[18:27:57] [0m  29) GitRemoteResolver .resolve should checkout correctly if resolution is a branch:
[18:27:57] [0m [31m     Uncaught Error: Tag/branch some-branch does not exist [0m [90m
....
[18:27:57] [0m  30) GitRemoteResolver #refs should resolve to the references of the remote repository:
[18:27:57]
[18:27:57]       [31mUncaught Error: expected [ '0a7daf646d4fd743b6ef701d63bdbe20eee422de refs/tags/0.0.1',
...
[18:27:57] [0m  31) GitRemoteResolver #refs should cache the results:
[18:27:57]
[18:27:57]       [31mUncaught Error: expected [ '0a7daf646d4fd743b6ef701d63bdbe20eee422de refs/tags/0.0.1',
...
[18:27:57] [0m  32) GitHub .constructor should ensure .git in the source:
[18:27:57] [0m [31m     Error: expected 'https://github.com/twitter/bower.git' to equal 'git://github.com/twitter/bower.git' [0m [90m
...
[18:27:57] [0m  33) resolverFactory should recognize git remote endpoints correctly:
[18:27:57] [0m [31m     Uncaught Error: expected 'https://github.com/bower/bower.git' to equal 'git://github.com/bower/bower.git' [0m [90m
...
[18:27:57] [0m  34) resolverFactory should recognize GitHub endpoints correctly:
[18:27:57] [0m [31m     Uncaught Error: expected 'https://github.com/user/project.git' to equal 'git://github.com/user/project.git' [0m [90m
...
[18:27:57] [0m  35) resolverFactory should recognize registry endpoints correctly:
[18:27:57] [0m [31m     Uncaught Error: expected 'https://github.com/IndigoUnited/dejavu.git' to equal 'git://github.com/IndigoUnited/dejavu.git' [0m [90m
...
[18:27:57] [0m  36) resolverFactory should use the configured shorthand resolver:
[18:27:57] [0m [31m     Uncaught Error: expected 'https://github.com/bower/bower.git' to equal 'git://github.com/bower/bower.git' [0m [90m

1 个答案:

答案 0 :(得分:0)

我们遇到了同样的问题,它与bower在nfs存储上使用的tmp目录有关。验证您的tmp目录(由.bowerrc中的“tmp”或env var TMP_DIR指定)不在nfs安装的存储上。