Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

node.js

npm

bower

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.

like image 879
Adam Avatar asked Jul 11 '14 20:07

Adam


1 Answers

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!

like image 102
cmikeb1 Avatar answered Oct 05 '22 10:10

cmikeb1