在Mac OSX上安装Bower时,path.join的参数必须是字符串

时间:2015-03-08 13:14:51

标签: node.js macos bower bower-install

尝试在Mac OSX Mavericks上安装Bower时遇到以下错误。

Craig-R-Mortons-MacBook:crmpicco crmpicco$ node_modules/bower/bin/bower cache clean
Craig-R-Mortons-MacBook:crmpicco crmpicco$ node_modules/bower/bin/bower install
bower not-cached    git://github.com/angular/bower-angular-mocks.git#~1.2.9
bower resolve       git://github.com/angular/bower-angular-mocks.git#~1.2.9
bower not-cached    git://github.com/angular/bower-angular-resource.git#~1.2.9
bower resolve       git://github.com/angular/bower-angular-resource.git#~1.2.9
bower not-cached    git://github.com/angular/bower-angular.git#~1.2.9
bower resolve       git://github.com/angular/bower-angular.git#~1.2.9
bower not-cached    git://github.com/angular-ui/ui-router.git#0.2.7
bower resolve       git://github.com/angular-ui/ui-router.git#0.2.7
bower not-cached    git://github.com/jashkenas/underscore.git#~1.5.2
bower resolve       git://github.com/jashkenas/underscore.git#~1.5.2
bower error         Arguments to path.join must be strings

Stack trace:
TypeError: Arguments to path.join must be strings
    at Object.posix.join (path.js:471:13)
    at GitHubResolver._checkout (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/lib/core/resolvers/GitHubResolver.js:54:21)
    at /Applications/MAMP/htdocs/crmpicco/node_modules/bower/lib/core/resolvers/GitResolver.js:69:21
    at _fulfilled (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:798:54)
    at self.promiseDispatch.done (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:827:30)
    at Promise.promise.promiseDispatch (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:760:13)
    at /Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:574:44
    at flush (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:355:11)

Console trace:
Trace
    at StandardRenderer.error (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/lib/renderers/StandardRenderer.js:74:17)
    at Logger.<anonymous> (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/bin/bower:109:18)
    at Logger.emit (events.js:107:17)
    at Logger.emit (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/bower-logger/lib/Logger.js:29:39)
    at /Applications/MAMP/htdocs/crmpicco/node_modules/bower/lib/commands/install.js:27:16
    at _rejected (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:808:24)
    at /Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:834:30
    at Promise.when (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:1079:31)
    at Promise.promise.promiseDispatch (/Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:752:41)
    at /Applications/MAMP/htdocs/crmpicco/node_modules/bower/node_modules/q/q.js:574:44

System info:
Bower version: 1.3.6
Node version: 0.12.0
OS: Darwin 14.1.0 x64

我遇到this post on GitHub,但更新到Bower 1.3.6对我没有任何影响 - 即使在执行bower cache cleannpm cache clean后也是如此。

这是我的package.json

{
  "name": "bower",
  "version": "1.3.6",
  "description": "The browser package manager.",
  "author": {
    "name": "Twitter"
  },
  "licenses": [
    {
      "type": "MIT",
      "url": "https://github.com/bower/bower/blob/master/LICENSE"
    }
  ],
  "repository": {
    "type": "git",
    "url": "git://github.com/bower/bower.git"
  },
  "main": "lib",
  "homepage": "http://bower.io",
  "engines": {
    "node": ">=0.8.0"
  },
  "dependencies": {
    "abbrev": "~1.0.4",
    "archy": "0.0.2",
    "bower-config": "~0.5.0",
    "bower-endpoint-parser": "~0.2.0",
    "bower-json": "~0.4.0",
    "bower-logger": "~0.2.1",
    "bower-registry-client": "~0.1.4",
    "cardinal": "~0.4.0",
    "chalk": "~0.2.0",
    "chmodr": "~0.1.0",
    "decompress-zip": "~0.0.3",
    "fstream": "~0.1.22",
    "fstream-ignore": "~0.0.6",
    "glob": "~3.2.1",
    "graceful-fs": "~2.0.0",
    "handlebars": "~1.0.11",
    "inquirer": "~0.3.0",
    "junk": "~0.2.0",
    "mkdirp": "~0.3.5",
    "mout": "~0.7.0",
    "nopt": "~2.1.1",
    "lru-cache": "~2.3.0",
    "open": "~0.0.3",
    "osenv": "0.0.3",
    "promptly": "~0.2.0",
    "q": "~0.9.2",
    "request": "~2.27.0",
    "request-progress": "~0.3.0",
    "retry": "~0.6.0",
    "rimraf": "~2.2.0",
    "semver": "~2.1.0",
    "stringify-object": "~0.1.4",
    "sudo-block": "~0.2.0",
    "tar": "~0.1.17",
    "tmp": "~0.0.20",
    "update-notifier": "~0.1.3",
    "which": "~1.0.5",
    "p-throttler": "~0.0.1"
  },
  "devDependencies": {
    "tmp": "0.0.23",
    "bower": "1.3.6",
    "expect.js": "~0.2.0",
    "grunt": "~0.4.1",
    "grunt-simple-mocha": "~0.4.0",
    "grunt-contrib-watch": "~0.5.0",
    "grunt-contrib-jshint": "~0.6.0",
    "grunt-exec": "~0.4.2",
    "mocha": "~1.12.0",
    "nock": "~0.22.0",
    "istanbul": "~0.1.42",
    "proxyquire": "~0.5.0"
  },
  "scripts": {
    "test": "grunt test"
  },
  "bin": {
    "bower": "bin/bower"
  },
  "preferGlobal": true,
  "bugs": {
    "url": "https://github.com/bower/bower/issues"
  },
  "_id": "bower@1.2.8",
  "dist": {
    "shasum": "f63c0804a267d5ffaf2fd3fd488367e73dce202f",
    "tarball": "http://registry.npmjs.org/bower/-/bower-1.2.8.tgz"
  },
  "_from": "bower@>=1.2.8 <1.3.0",
  "_npmVersion": "1.3.14",
  "_npmUser": {
    "name": "wibblymat",
    "email": "mat@wibbly.org.uk"
  },
  "maintainers": [
    {
      "name": "fat",
      "email": "jacobthornton@gmail.com"
    },
    {
      "name": "satazor",
      "email": "andremiguelcruz@msn.com"
    },
    {
      "name": "wibblymat",
      "email": "mat@wibbly.org.uk"
    },
    {
      "name": "paulirish",
      "email": "paul.irish@gmail.com"
    }
  ],
  "directories": {},
  "_shasum": "f63c0804a267d5ffaf2fd3fd488367e73dce202f",
  "_resolved": "https://registry.npmjs.org/bower/-/bower-1.2.8.tgz"
}

1 个答案:

答案 0 :(得分:1)

我今天刚刚通过更新bower到最新版本解决了这个问题。截至今天,当前版本为1.4.1。您可以通过查看github上的package.json来查看当前版本。

要做更新凉亭,我运行了以下命令:

npm install -g bower

我认为此错误是由于我的.gitconfig文件中的以下行引起的。这条线就在那里,因为我正在尝试使用代理服务器在公司环境中工作。

[url "https://"]
    insteadOf = git://