Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All usage of Bower fails with "Arguments to path.join must be strings" #270

Closed
henrycatalinismith opened this issue Feb 23, 2013 · 10 comments
Milestone

Comments

@henrycatalinismith
Copy link

I've just installed bower 0.7.0 with npm install . and the following package.json:

{                                                                                                                           
  "name": "experiment",
  "version": "0.0.0",
  "dependencies": {
    "bower": "0.7.0"
  }
}

I'm running bower with ./node_modules/.bin/bower, and the command always fails with the following error message:

path.js:360
        throw new TypeError('Arguments to path.join must be strings');
              ^
TypeError: Arguments to path.join must be strings
    at path.js:360:15
    at Array.filter (native)
    at Object.exports.join (path.js:358:36)
    at Object.<anonymous> (/home/h2s/src/tdd-js-experiment/node_modules/bower/lib/core/config.js:41:22)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)

I've looked into the code in question, and the line causing the error looks like this:

var localFile = path.join(this.cwd, '.bowerrc');

The problem is that this.cwd is undefined when that line executes. Does this sound like my system might be misconfigured in some way?

For what it's worth, I reproduced the issue with version 0.6.0, and when doing a global installation with sudo npm install -g bower.

@kibao
Copy link

kibao commented Feb 23, 2013

Reproduced on Ubuntu 11.10 with node v0.9.11.pre

Quick fix is change this.cwd to process.cwd() cause this is empty object.
This works for me.

edit:
With node v0.8.20 works fine (without quick fix listed above).

@qaiser110
Copy link

I'm on windows 7 x64, and have installed the latest builds of Node.js, yeoman, bower
I'm still having the same issue with bower version "0.8.5",

$ yeoman build
Loading "bower.js" tasks and helpers...ERROR

TypeError: Arguments to path.join must be strings

@kevva
Copy link

kevva commented Mar 25, 2013

You're using an old version of yeoman, which might be the problem. See http://yeoman.io for info on how to upgrade.

@co2-git
Copy link

co2-git commented Mar 31, 2013

I have the same issue:

  • bower version: 0.8.5
  • node version: v0.11.1-pre

I confirm error not here with node v0.10.2. You can solve this issue using nvm (Node Version Manager: https://github.com/creationix/nvm). This is how I did it:

git clone git://github.com/creationix/nvm.git ~/.nvm
echo -e "\n. ~/.nvm/nvm.sh" >> ~/.bashrc
source ~/.bashrc
nvm install v0.10.2
nvm use v0.10.2 bower install

@qaiser110
Copy link

I used "grunt build" instead of "yeoman build" and it worked.
And @kevva , yes I had the latest yeoman.

@Timopheym
Copy link

falls to me 👎

$ node -v
v0.10.2
$ bower -v
0.9.2

$ bower install

/usr/local/lib/node_modules/bower/node_modules/tmp/lib/tmp.js:260
  throw err;
        ^
TypeError: Arguments to path.join must be strings
    at path.js:360:15
    at Array.filter (native)
    at Object.exports.join (path.js:358:36)
    at Package.generateResourceId (/usr/local/lib/node_modules/bower/lib/core/package.js:857:23)
    at null.<anonymous> (/usr/local/lib/node_modules/bower/lib/core/package.js:178:10)
    at Request._callback (/usr/local/lib/node_modules/bower/lib/core/source.js:38:9)
    at Request.self.callback (/usr/local/lib/node_modules/bower/node_modules/request/main.js:122:22)
    at Request.EventEmitter.emit (events.js:98:17)
    at Request.<anonymous> (/usr/local/lib/node_modules/bower/node_modules/request/main.js:655:16)
    at Request.EventEmitter.emit (events.js:117:20)

@tschaub
Copy link
Contributor

tschaub commented Jun 12, 2013

@Timopheym - you'll get this error if you have a dependency in bower.json that is not properly specified (see also #530 - this particular type of failure is addressed with 607e160). Would probably be easiest to troubleshoot if you paste your bower.json manifest somewhere.

@nijikokun
Copy link

I had this when using nvm, what I had to do was reload the node version, even if it was already running that version. It was odd, but it fixed my problem, not sure what caused it to be fixed but this is the only thing I did between it not working and it working so my bet is on refreshing node environment.

$ bower -v

path.js:360
        throw new TypeError('Arguments to path.join must be strings');
              ^
TypeError: Arguments to path.join must be strings
    at path.js:360:15
    at Array.filter (native)
    at Object.exports.join (path.js:358:36)
    at Object.<anonymous> (/Users/mashape/nvm/v0.8.15/lib/node_modules/bower/lib/core/config.js:35:22)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)

$ nvm use v0.10.15
Now using node v0.10.15

$ bower -v
1.2.7

@iredmedia
Copy link

On windows 7, i had to reinstall bower. npm install bower solved the issue for me.

@dragosrususv
Copy link

@iredmedia : that fixed it, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests