bower icon indicating copy to clipboard operation
bower copied to clipboard

v1.6.2 .bowerrc registry.register.replace undefined

Open anwalkers opened this issue 11 years ago • 3 comments

If the .bowerrc has the registry configuration element, bower fails on Windows.

$ bower
C:\Users\username\AppData\Roaming\npm\node_modules\bower\node_modules\bower-config\lib\Config.js:96
    config.registry.register = config.registry.register.replace(/\/+$/, '');
                                                       ^

TypeError: Cannot read property 'replace' of undefined
    at normalise (C:\Users\username\AppData\Roaming\npm\node_modules\bower\node_modules\bower-config\lib\Config.js:96:56)
    at Config.load (C:\Users\username\AppData\Roaming\npm\node_modules\bower\node_modules\bower-config\lib\Config.js:23:20)
    at readCachedConfig (C:\Users\username\AppData\Roaming\npm\node_modules\bower\lib\config.js:15:39)
    at defaultConfig (C:\Users\username\AppData\Roaming\npm\node_modules\bower\lib\config.js:11:12)
    at Object. (C:\Users\username\AppData\Roaming\npm\node_modules\bower\lib\index.js:40:32)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)

Working .bowerrc:

{
    "directory": "app/components"
}

Failing .bowerrc

{
    "directory": "app/components",
    "registry": {
        "search": [ "https://bower.herokuapp.com" ]
    }
}

anwalkers avatar Oct 15 '15 18:10 anwalkers

We have the same problem, but on Linux, so it doesn't seem to be OS-related.

.bowerrc:

{
  "directory" : "bower_components"
}

Error:

15-Oct-2015 22:22:17    [email protected] node_modules/bower
15-Oct-2015 22:22:17    + set -e
15-Oct-2015 22:22:17    + cd aui
15-Oct-2015 22:22:17    + ./node_modules/.bin/bower link --no-color
15-Oct-2015 22:22:18    bower                    link /opt/bamboo-agent/.local/share/bower/links/aui > /opt/bamboo-agent/bamboo-agent-home/xml-data/build-dir/AUI-JAR1-JOB1/aui
15-Oct-2015 22:22:18    + cd ../aui-adg
15-Oct-2015 22:22:18    + ./node_modules/.bin/bower link aui --no-color
15-Oct-2015 22:22:19    /opt/bamboo-agent/bamboo-agent-home/xml-data/build-dir/AUI-JAR1-JOB1/aui-adg/node_modules/bower/node_modules/bower-config/lib/Config.js:96
15-Oct-2015 22:22:19        config.registry.register = config.registry.register.replace(/\/+$/, '');
15-Oct-2015 22:22:19                                                           ^
15-Oct-2015 22:22:19    TypeError: Cannot read property 'replace' of undefined
15-Oct-2015 22:22:19        at normalise (/opt/bamboo-agent/bamboo-agent-home/xml-data/build-dir/AUI-JAR1-JOB1/aui-adg/node_modules/bower/node_modules/bower-config/lib/Config.js:96:56)
15-Oct-2015 22:22:19        at Config.load (/opt/bamboo-agent/bamboo-agent-home/xml-data/build-dir/AUI-JAR1-JOB1/aui-adg/node_modules/bower/node_modules/bower-config/lib/Config.js:23:20)
15-Oct-2015 22:22:19        at readCachedConfig (/opt/bamboo-agent/bamboo-agent-home/xml-data/build-dir/AUI-JAR1-JOB1/aui-adg/node_modules/bower/lib/config.js:15:39)
15-Oct-2015 22:22:19        at defaultConfig (/opt/bamboo-agent/bamboo-agent-home/xml-data/build-dir/AUI-JAR1-JOB1/aui-adg/node_modules/bower/lib/config.js:11:12)
15-Oct-2015 22:22:19        at Object.<anonymous> (/opt/bamboo-agent/bamboo-agent-home/xml-data/build-dir/AUI-JAR1-JOB1/aui-adg/node_modules/bower/lib/index.js:40:32)
15-Oct-2015 22:22:19        at Module._compile (module.js:460:26)
15-Oct-2015 22:22:19        at Object.Module._extensions..js (module.js:478:10)
15-Oct-2015 22:22:19        at Module.load (module.js:355:32)
15-Oct-2015 22:22:19        at Function.Module._load (module.js:310:12)
15-Oct-2015 22:22:19        at Module.require (module.js:365:17)

joscha avatar Oct 15 '15 22:10 joscha

If you specify bower.search, also specifying bower.register and bower.publish values will act as a workaround, but the documentation doesn't seem to suggest these are all required if search is specified.

rowanbeentje avatar Oct 15 '15 23:10 rowanbeentje

Should be fixed in bower 1.6.3. Thanks for the report

sheerun avatar Oct 16 '15 09:10 sheerun