Kimmo Hintikka
Kimmo Hintikka

Reputation: 15420

How bower install actually find packages?

I ran into a bizarre issue when trying to install bootstrap#v4.0.0-alpha.5 for my personal blog.

First I tried to run bower install bootstrap#v4.0.0-alpha.5 Resulted error > zsh: no matches found: bootstrap#v4.0.0-alpha.5

Then I tried to run bower install bootstrap --force-latest Please note I I also ran this again with bower cache clear As seen this installs latest stable not latest version.

Results below >

bower bootstrap#*           not-cached https://github.com/twbs/bootstrap.git#*
bower bootstrap#*              resolve https://github.com/twbs/bootstrap.git#*
bower bootstrap#*             download https://github.com/twbs/bootstrap/archive/v3.3.7.tar.gz
bower bootstrap#*              extract archive.tar.gz
bower bootstrap#*             resolved https://github.com/twbs/bootstrap.git#3.3.7
bower jquery#1.9.1 - 3      not-cached https://github.com/jquery/jquery-dist.git#1.9.1 - 3
bower jquery#1.9.1 - 3         resolve https://github.com/jquery/jquery-dist.git#1.9.1 - 3
bower jquery#1.9.1 - 3        download https://github.com/jquery/jquery-dist/archive/3.1.1.tar.gz
bower jquery#1.9.1 - 3         extract archive.tar.gz
bower jquery#1.9.1 - 3        resolved https://github.com/jquery/jquery-dist.git#3.1.1
bower bootstrap#^3.3.7         install bootstrap#3.3.7
bower jquery#1.9.1 - 3         install jquery#3.1.1

bootstrap#3.3.7 bower_components/bootstrap
└── jquery#3.1.1

jquery#3.1.1 bower_components/jquery

I solved this by running bower init and creating bower.json below and run bower install in the project root.

My bower.json >

{
  "name": "kimmohintikka",
  "description": "",
  "main": "index.js",
  "authors": [
    "HintikkaKimmo <[email protected]>"
  ],
  "license": "ISC",
  "homepage": "",
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "test",
    "tests"
  ],
  "dependencies": {
    "bootstrap": "^4.0.0-alpha.5"
  }
}

Finally to my question. Is this issue with Bower or with the way bootstrap alpha is named or just me not understanding how to use bower? When I run bower install it will install exactly the package I tried to install in the first place.

See output below >

2.7.11/envs/kimmohintikka) ➜  kimmohintikka git:(master) ✗ bower install
bower bootstrap#^4.0.0-alpha.5       not-cached https://github.com/twbs/bootstrap.git#^4.0.0-alpha.5
bower bootstrap#^4.0.0-alpha.5          resolve https://github.com/twbs/bootstrap.git#^4.0.0-alpha.5
bower bootstrap#^4.0.0-alpha.5         download https://github.com/twbs/bootstrap/archive/v4.0.0-alpha.5.tar.gz
bower bootstrap#^4.0.0-alpha.5          extract archive.tar.gz
bower bootstrap#^4.0.0-alpha.5         resolved https://github.com/twbs/bootstrap.git#4.0.0-alpha.5
bower tether#^1.3.7                  not-cached https://github.com/HubSpot/tether.git#^1.3.7
bower tether#^1.3.7                     resolve https://github.com/HubSpot/tether.git#^1.3.7
bower tether#^1.3.7                    download https://github.com/HubSpot/tether/archive/v1.3.7.tar.gz
bower tether#^1.3.7                     extract archive.tar.gz
bower tether#^1.3.7                    resolved https://github.com/HubSpot/tether.git#1.3.7
bower bootstrap#^4.0.0-alpha.5          install bootstrap#4.0.0-alpha.5
bower tether#^1.3.7                     install tether#1.3.7

bootstrap#4.0.0-alpha.5 bower_components/bootstrap
├── jquery#3.1.1
└── tether#1.3.7

tether#1.3.7 bower_components/tether

Upvotes: 0

Views: 571

Answers (1)

Bojan
Bojan

Reputation: 186

After some research we found that real culprit is zsh, detailed here: http://coderwall.com/p/nqckeq/zsh-bower-and-command-not-found

The ZSH is doing something in its own agenda, so you can remove its global setting for bower by adding this alias bower='noglob bower' to your ~/.zshrc file or you use command with "quotes" bower install "bootstrap#v4.0.0-alpha.5"


Hm, you really did find a strange one, tested bower install and it worked, so it's not bootstrap version number for sure.

D:\git\test>bower install bootstrap#v4.0.0-alpha.5
bower bootstrap#v4.0.0-alpha.5       not-cached https://github.com/twbs/bootstrap.git#v4.0.0-alpha.5
bower bootstrap#v4.0.0-alpha.5          resolve https://github.com/twbs/bootstrap.git#v4.0.0-alpha.5
bower bootstrap#v4.0.0-alpha.5         download https://github.com/twbs/bootstrap/archive/v4.0.0-alpha.5.tar.gz
bower bootstrap#v4.0.0-alpha.5          extract archive.tar.gz
bower bootstrap#v4.0.0-alpha.5         resolved https://github.com/twbs/bootstrap.git#4.0.0-alpha.5
bower jquery#1.9.1 - 3                   cached https://github.com/jquery/jquery-dist.git#3.1.1
bower jquery#1.9.1 - 3                 validate 3.1.1 against https://github.com/jquery/jquery-dist.git#1.9.1 - 3
bower tether#^1.3.7                  not-cached https://github.com/HubSpot/tether.git#^1.3.7
bower tether#^1.3.7                     resolve https://github.com/HubSpot/tether.git#^1.3.7
bower tether#^1.3.7                    download https://github.com/HubSpot/tether/archive/v1.3.7.tar.gz
bower tether#^1.3.7                     extract archive.tar.gz
bower tether#^1.3.7                    resolved https://github.com/HubSpot/tether.git#1.3.7
bower bootstrap#v4.0.0-alpha.5          install bootstrap#4.0.0-alpha.5
bower jquery#1.9.1 - 3                  install jquery#3.1.1
bower tether#^1.3.7                     install tether#1.3.7

bootstrap#4.0.0-alpha.5 bower_components\bootstrap
├── jquery#3.1.1
└── tether#1.3.7

jquery#3.1.1 bower_components\jquery

tether#1.3.7 bower_components\tether

What is your bower version? Did you try to update it?

Also what do you get when you try: bower install bootstrap#^4.0.0-alpha.5 this would simulate your bower.json

You can also get a list of all available releases and prereleases for bootstrap with this command: bower info bootstrap --verbose

Here is what versions I get from it:

D:\git\test>bower info bootstrap --verbose
bower bootstrap#*               cached https://github.com/twbs/bootstrap.git#3.3.7
bower bootstrap#*             validate 3.3.7 against https://github.com/twbs/bootstrap.git#*

{
  name: 'bootstrap',
  description: 'The most popular front-end framework for developing responsive, mobile first projects on the web.',
  keywords: [
    'css',
    'js',
    'less',
    'mobile-first',
    'responsive',
    'front-end',
    'framework',
    'web'
  ],
  homepage: 'http://getbootstrap.com',
  license: 'MIT',
  moduleType: 'globals',
  main: [
    'less/bootstrap.less',
    'dist/js/bootstrap.js'
  ],
  ignore: [
    '/.*',
    '_config.yml',
    'CNAME',
    'composer.json',
    'CONTRIBUTING.md',
    'docs',
    'js/tests',
    'test-infra'
  ],
  dependencies: {
    jquery: '1.9.1 - 3'
  },
  version: '3.3.7'
}

Available versions:
  - 4.0.0-alpha.5
  - 4.0.0-alpha.4
  - 4.0.0-alpha.3
  - 4.0.0-alpha.2
  - 4.0.0-alpha
  - 3.3.7
  - 3.3.6
  - 3.3.5
  - 3.3.4
  - 3.3.2
  - 3.3.1
  - 3.3.0
  - 3.2.0
  - 3.1.1
  - 3.1.0
  - 3.0.3
  - 3.0.2
  - 3.0.1
  - 3.0.0
  - 3.0.0-rc1
  - 3.0.0-rc.2
  - 2.3.2
  - 2.3.1
  - 2.3.0
  - 2.2.2
  - 2.2.1
  - 2.2.0
  - 2.1.1
  - 2.1.0
  - 2.0.4
  - 2.0.3
  - 2.0.2
  - 2.0.1
  - 2.0.0
  - 1.4.0
  - 1.3.0
  - 1.2.0
  - 1.1.1
  - 1.1.0
  - 1.0.0

You can request info for a specific version with 'bower info bootstrap#<version>'

Upvotes: 1

Related Questions