Search code examples
jenkinscontinuous-integrationbuild-processbower

Executing Bower in a CI Environment, such as Jenkins


My Jenkins is running on CentOS 6 with node.js 0.10.15 and bower 1.0.3.

I have a shell task which executes the following:

npm install
bower install
grunt clean package

The bower installation fails when building:

+ bower install

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> (/usr/lib/node_modules/bower/node_modules/
                           update-notifier/node_modules/configstore/configstore.js:9:7)
    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)

Build step 'Execute shell' marked build as failure

When I'm executing bower install in a terminal while logged in as the Jenkins user, it works. The other mentioned commands work as expected (npm, grunt).

Any ideas?


Solution

  • It appears that your execution environment has neither $XDG_CONFIG_HOME nor $HOME set as environment variables.

    You can work around this by manually setting it, for example, to the current workspace:

    export XDG_CONFIG_HOME="$WORKSPACE/.config"
    ...
    bower install