質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
npm

npmは、Node Packaged Modulesの略。Node.jsのライブラリ・パッケージを管理できるツールです。様々なモジュールを簡単にインストールでき、自分でモジュールを作成し公開する際にも使用できます。

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

JavaScript

JavaScriptは、プログラミング言語のひとつです。ネットスケープコミュニケーションズで開発されました。 開発当初はLiveScriptと呼ばれていましたが、業務提携していたサン・マイクロシステムズが開発したJavaが脚光を浴びていたことから、JavaScriptと改名されました。 動きのあるWebページを作ることを目的に開発されたもので、主要なWebブラウザのほとんどに搭載されています。

AngularJS

AngularJSはオープンソースのJavaScriptフレームワークです。ブラウザ上で動作するウェブアプリケーションの開発にMVCアーキテクチャを取り入れることを目的としています。

Bower

A package manager for the web

Q&A

解決済

1回答

2460閲覧

BowerでAngular1.4.0をインストールする際に異なるバージョンがインストールされる

退会済みユーザー

退会済みユーザー

総合スコア0

npm

npmは、Node Packaged Modulesの略。Node.jsのライブラリ・パッケージを管理できるツールです。様々なモジュールを簡単にインストールでき、自分でモジュールを作成し公開する際にも使用できます。

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

JavaScript

JavaScriptは、プログラミング言語のひとつです。ネットスケープコミュニケーションズで開発されました。 開発当初はLiveScriptと呼ばれていましたが、業務提携していたサン・マイクロシステムズが開発したJavaが脚光を浴びていたことから、JavaScriptと改名されました。 動きのあるWebページを作ることを目的に開発されたもので、主要なWebブラウザのほとんどに搭載されています。

AngularJS

AngularJSはオープンソースのJavaScriptフレームワークです。ブラウザ上で動作するウェブアプリケーションの開発にMVCアーキテクチャを取り入れることを目的としています。

Bower

A package manager for the web

0グッド

0クリップ

投稿2017/01/24 08:01

編集2017/01/24 08:02

##環境・各種バージョン
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は廃止されたということでいいのでしょうか?

ご教示お願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

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

投稿2017/01/25 12:07

退会済みユーザー

退会済みユーザー

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

退会済みユーザー

退会済みユーザー

2017/01/26 16:14

ご回答ありがとうございます。 確かに(^)を外すとインストールできました。npm特有のものなのですね。 助かりました。ありがとうございました!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問