BowerでAngular1.4.0をインストールする際に異なるバージョンがインストールされる
- 評価
- クリップ 0
- VIEW 1,605

退会済みユーザー
環境・各種バージョン
CentOS7(Vagarnt+Virtualbox)
- node => 6.9.1
- npm => 3.10.8
- yeoman => 1.8.5
- bower => 1.8.0
- grunt-cli => 1.2.0
- grunt => 0.4.5
- yeoman => 1.8.5
行ったこと
Yeoman(yo grunt bower)と呼ばれるツールを利用してAnagularの雛形環境を作成しました。
今回はBowerでAngularが正しくインストールできないという問題なので、Grunt yoについてはあまり関係がないと思います。
問題に気づいたのは、Angularで使用されている$httpのsuccess, errroメソッドが使えなくなっていたからです。調べたところAngularの1.6からsuccess, errorメソッドが消え、thenに置き換えられたらしいです。
https://docs.angularjs.org/guide/migration#migrate1.5to1.6-ng-services-$http
Chromeのconsoleでangular.version.fullを実行したところ1.6.1が表示されました。
bowerで1.4をインストールしているはずなのですが、なぜか1.6に置き換わっていました。
bower.jsonは以下の通りです
{
"name": "front",
"version": "0.0.0",
"dependencies": {
"angular": "^1.4.0",
"bootstrap-sass-official": "^3.2.0",
"angular-animate": "^1.4.0",
"angular-cookies": "^1.4.0",
"angular-resource": "^1.4.0",
"angular-route": "^1.4.0",
"angular-sanitize": "^1.4.0",
"angular-touch": "^1.4.0"
},
"devDependencies": {
"angular-mocks": "^1.4.0"
},
"appPath": "app",
"moduleName": "frontApp",
"overrides": {
"bootstrap": {
"main": [
"less/bootstrap.less",
"dist/css/bootstrap.css",
"dist/js/bootstrap.js"
]
}
}
}
bower installをした際のログの様子を下に示します。
bower not-cached https://github.com/angular/bower-angular-touch.git#^1.4.0
bower resolve https://github.com/angular/bower-angular-touch.git#^1.4.0
bower not-cached https://github.com/angular/bower-angular-route.git#^1.4.0
bower resolve https://github.com/angular/bower-angular-route.git#^1.4.0
bower not-cached https://github.com/angular/bower-angular.git#^1.4.0
bower resolve https://github.com/angular/bower-angular.git#^1.4.0
bower not-cached https://github.com/angular/bower-angular-resource.git#^1.4.0
bower resolve https://github.com/angular/bower-angular-resource.git#^1.4.0
bower not-cached https://github.com/angular/bower-angular-sanitize.git#^1.4.0
bower resolve https://github.com/angular/bower-angular-sanitize.git#^1.4.0
bower not-cached https://github.com/angular/bower-angular-mocks.git#^1.4.0
bower resolve https://github.com/angular/bower-angular-mocks.git#^1.4.0
bower not-cached https://github.com/angular/bower-angular-animate.git#^1.4.0
bower resolve https://github.com/angular/bower-angular-animate.git#^1.4.0
bower not-cached https://github.com/angular/bower-angular-cookies.git#^1.4.0
bower resolve https://github.com/angular/bower-angular-cookies.git#^1.4.0
bower not-cached https://github.com/twbs/bootstrap-sass.git#^3.2.0
bower resolve https://github.com/twbs/bootstrap-sass.git#^3.2.0
bower download https://github.com/angular/bower-angular-sanitize/archive/v1.6.1.tar.gz
bower download https://github.com/angular/bower-angular-touch/archive/v1.6.1.tar.gz
bower download https://github.com/angular/bower-angular-route/archive/v1.6.1.tar.gz
bower download https://github.com/angular/bower-angular/archive/v1.6.1.tar.gz
bower download https://github.com/angular/bower-angular-resource/archive/v1.6.1.tar.gz
bower download https://github.com/twbs/bootstrap-sass/archive/v3.3.7.tar.gz
bower download https://github.com/angular/bower-angular-mocks/archive/v1.6.1.tar.gz
bower download https://github.com/angular/bower-angular-animate/archive/v1.6.1.tar.gz
bower download https://github.com/angular/bower-angular-cookies/archive/v1.6.1.tar.gz
bower extract angular-sanitize#^1.4.0 archive.tar.gz
bower resolved https://github.com/angular/bower-angular-sanitize.git#1.6.1
bower extract angular-route#^1.4.0 archive.tar.gz
bower resolved https://github.com/angular/bower-angular-route.git#1.6.1
bower extract angular-resource#^1.4.0 archive.tar.gz
bower resolved https://github.com/angular/bower-angular-resource.git#1.6.1
bower extract angular-mocks#^1.4.0 archive.tar.gz
bower extract angular-touch#^1.4.0 archive.tar.gz
bower resolved https://github.com/angular/bower-angular-mocks.git#1.6.1
bower resolved https://github.com/angular/bower-angular-touch.git#1.6.1
bower extract angular-cookies#^1.4.0 archive.tar.gz
bower resolved https://github.com/angular/bower-angular-cookies.git#1.6.1
bower extract angular-animate#^1.4.0 archive.tar.gz
bower resolved https://github.com/angular/bower-angular-animate.git#1.6.1
bower extract bootstrap-sass-official#^3.2.0 archive.tar.gz
bower resolved https://github.com/twbs/bootstrap-sass.git#3.3.7
bower extract angular#^1.4.0 archive.tar.gz
bower resolved https://github.com/angular/bower-angular.git#1.6.1
bower not-cached https://github.com/jquery/jquery-dist.git#1.9.1 - 3
bower resolve https://github.com/jquery/jquery-dist.git#1.9.1 - 3
bower download https://github.com/jquery/jquery-dist/archive/3.1.1.tar.gz
bower extract jquery#1.9.1 - 3 archive.tar.gz
bower resolved https://github.com/jquery/jquery-dist.git#3.1.1
bower install angular-sanitize#1.6.1
bower install angular-route#1.6.1
bower install angular-resource#1.6.1
bower install angular-mocks#1.6.1
bower install angular-touch#1.6.1
bower install angular-cookies#1.6.1
bower install angular-animate#1.6.1
bower install bootstrap-sass-official#3.3.7
bower install angular#1.6.1
bower install jquery#3.1.1
angular-sanitize#1.6.1 bower_components/angular-sanitize
└── angular#1.6.1
angular-route#1.6.1 bower_components/angular-route
└── angular#1.6.1
angular-resource#1.6.1 bower_components/angular-resource
└── angular#1.6.1
angular-mocks#1.6.1 bower_components/angular-mocks
└── angular#1.6.1
angular-touch#1.6.1 bower_components/angular-touch
└── angular#1.6.1
angular-cookies#1.6.1 bower_components/angular-cookies
└── angular#1.6.1
angular-animate#1.6.1 bower_components/angular-animate
└── angular#1.6.1
bootstrap-sass-official#3.3.7 bower_components/bootstrap-sass-official
└── jquery#3.1.1
angular#1.6.1 bower_components/angular
jquery#3.1.1 bower_components/jquery
ログを見てURLを調べてみると
https://github.com/angular/bower-angular-touch.git#^1.4.0
Angularのバージョンが1.6.2となっていました。
1.4は廃止されたということでいいのでしょうか?
ご教示お願いいたします。
-
気になる質問をクリップする
クリップした質問は、後からいつでもマイページで確認できます。
またクリップした質問に回答があった際、通知やメールを受け取ることができます。
クリップを取り消します
-
良い質問の評価を上げる
以下のような質問は評価を上げましょう
- 質問内容が明確
- 自分も答えを知りたい
- 質問者以外のユーザにも役立つ
評価が高い質問は、TOPページの「注目」タブのフィードに表示されやすくなります。
質問の評価を上げたことを取り消します
-
評価を下げられる数の上限に達しました
評価を下げることができません
- 1日5回まで評価を下げられます
- 1日に1ユーザに対して2回まで評価を下げられます
質問の評価を下げる
teratailでは下記のような質問を「具体的に困っていることがない質問」、「サイトポリシーに違反する質問」と定義し、推奨していません。
- プログラミングに関係のない質問
- やってほしいことだけを記載した丸投げの質問
- 問題・課題が含まれていない質問
- 意図的に内容が抹消された質問
- 過去に投稿した質問と同じ内容の質問
- 広告と受け取られるような投稿
評価が下がると、TOPページの「アクティブ」「注目」タブのフィードに表示されにくくなります。
質問の評価を下げたことを取り消します
この機能は開放されていません
評価を下げる条件を満たしてません
質問の評価を下げる機能の利用条件
この機能を利用するためには、以下の事項を行う必要があります。
- 質問回答など一定の行動
-
メールアドレスの認証
メールアドレスの認証
-
質問評価に関するヘルプページの閲覧
質問評価に関するヘルプページの閲覧
checkベストアンサー
0
versionの指定が"^1.4.0"になっているからです
先頭に(^)を付けると1.x.xの最新バージョンがインストールされます。
1.4.0をインストールするには、先頭の^を消して"1.4.0"にすると良いです
(参考)
http://qiita.com/sotarok/items/4ebd4cfedab186355867
https://github.com/npm/node-semver
投稿
-
回答の評価を上げる
以下のような回答は評価を上げましょう
- 正しい回答
- わかりやすい回答
- ためになる回答
評価が高い回答ほどページの上位に表示されます。
-
回答の評価を下げる
下記のような回答は推奨されていません。
- 間違っている回答
- 質問の回答になっていない投稿
- スパムや攻撃的な表現を用いた投稿
評価を下げる際はその理由を明確に伝え、適切な回答に修正してもらいましょう。
15分調べてもわからないことは、teratailで質問しよう!
- ただいまの回答率 88.13%
- 質問をまとめることで、思考を整理して素早く解決
- テンプレート機能で、簡単に質問をまとめられる
2017/01/27 01:14
確かに(^)を外すとインストールできました。npm特有のものなのですね。
助かりました。ありがとうございました!