Bower - error when installing package "Arguments to path.join must be strings"
Asked Answered
L

3

14

I just created a node project and am trying to install jquery using bower.

bower install jquery

I get the following error:

bower jquery#*              not-cached git://github.com/jquery/jquery.git#*
bower jquery#*                 resolve git://github.com/jquery/jquery.git#*
bower jquery#*                   error Arguments to path.join must be strings

Stack trace:
TypeError: Arguments to path.join must be strings
    at f (path.js:204:15)
    at Object.filter (native)
    at Object.exports.join (path.js:209:40)
    at GitHubResolver._checkout (C:\Users\Adam\AppData\Roaming\npm\node_modules\bower\lib\core\resolvers\GitHubResolver.js:54:21)
    at C:\Users\Adam\AppData\Roaming\npm\node_modules\bower\lib\core\resolvers\GitResolver.js:69:21
    at _fulfilled (C:\Users\Adam\AppData\Roaming\npm\node_modules\bower\node_modules\p-throttler\node_modules\q\q.js:798:54)
    at self.promiseDispatch.done (C:\Users\Adam\AppData\Roaming\npm\node_modules\bower\node_modules\p-throttler\node_modules\q\q.js:827:30)
    at Promise.promise.promiseDispatch (C:\Users\Adam\AppData\Roaming\npm\node_modules\bower\node_modules\p-throttler\node_modules\q\q.js:760:13)
    at C:\Users\Adam\AppData\Roaming\npm\node_modules\bower\node_modules\p-throttler\node_modules\q\q.js:574:44
    at flush (C:\Users\Adam\AppData\Roaming\npm\node_modules\bower\node_modules\p-throttler\node_modules\q\q.js:108:17)

Console trace:
Trace
    at StandardRenderer.error (C:\Users\Adam\AppData\Roaming\npm\node_modules\bower\lib\renderers\StandardRenderer.js:72:17)
    at Logger.<anonymous> (C:\Users\Adam\AppData\Roaming\npm\node_modules\bower\bin\bower:111:22)
    at Logger.emit (events.js:95:17)
    at Logger.emit (C:\Users\Adam\AppData\Roaming\npm\node_modules\bower\node_modules\bower-logger\lib\Logger.js:29:39)
    at C:\Users\Adam\AppData\Roaming\npm\node_modules\bower\lib\commands\index.js:40:20
    at _rejected (C:\Users\Adam\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:797:24)
    at C:\Users\Adam\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:823:30
    at Promise.when (C:\Users\Adam\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:1035:31)
    at Promise.promise.promiseDispatch (C:\Users\Adam\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:741:41)
    at C:\Users\Adam\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:557:44

System info:
Bower version: 1.3.7
Node version: 0.10.29
OS: Windows_NT 6.2.9200 x64

I've tried installing other packages and they fail with the same error. I've got a pretty vanilla setup as far as I know. Running Windows 8.1 x64. Can't seem to find relevant info about why I'm getting this error.

Lungwort answered 11/7, 2014 at 20:55 Comment(3)
I'm having the same issue. I tried downgrading to the last version of bower which worked before (1.3.5) and clearing my npm cache to no avail. Also removed my bower.json file, bower_components folder and still get the error for all packages (with or without the -S flag)...Southdown
Bummer. Well at least I'm not alone on this. I also had no luck when deleting my npm cache folder.Lungwort
Me too. I wonder if this is an issue with Github (GitHubResolver)? This appears to suddenly become a problem in the last hour.Locoism
L
21

Fix: Clear cache and update to Bower 1.3.8.

This is what's going on:

The tmp package updated it's API to return a cleanup callback in addition to just the directory name. Q then squashes the two arguments to the callback into an array, while bower expected just a string for the directory name.

This causes "TypeError: Arguments to path.join must be strings" errors to appear, seemingly non-deterministic, because various spots attempt to use the _tempDir value (now an array) to join into a path.

semver ftw!

Locoism answered 11/7, 2014 at 21:20 Comment(2)
Awesome! Thanks, back up and working. Leave it to me to find these 0day bugs :DLungwort
You're welcome, this had me pulling some hair out too. Luckily I stumbled upon the Bower twitter feed. Good on the Bower folks for being on top of things.Locoism
P
1

For other people who are still running into this, this did the trick for me:

bower cache clean
Pronator answered 23/8, 2014 at 19:11 Comment(0)
T
1

For me npm install -update bower was not sufficient.

I needed to install the version by specifing it explicit:

sudo npm install -q [email protected]

and yes, I had to run this with sudo.

Thallium answered 29/1, 2016 at 14:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.