npm install 時に peerDependency でエラーがでるとき

node.js v0.12.4を使っているときに、npm install で generator-webapp などをインストールするときに、警告がでていて気になりました。

npm WARN peerDependencies The peer dependency yo@>=1.0.0 included from generator-mocha will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency 
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
 
npm WARN peerDependencies The peer dependency yo@>=1.2.0 included from generator-webapp will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency 
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.

npm WARN peerDependencies The peer dependency generator-mocha@>=0.1.0 included from generator-webapp will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency 
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.

依存関係にあるgenerator-mochaは自動でインストールされなくなるということのようなので、下記のようなファイル npm_package_install.sh を用意して実行することで、解決できました。キャッシュは念のためクリアしてからインストールしてみています。

#!/bin/sh

npm cache clean -f
npm install -g grunt-cli \
 bower \
 yo \
 yeoman-generator \
 generator-mocha \
 generator-webapp \
 generator-karma \
 generator-angular

実行をするには下記。

$ sh npm_package_install.sh 

環境によっては、sudo が必要です。

$ sudo sh npm_package_install.sh 
同じタグの記事: node.js
同じタグの記事: npm
同じカテゴリの記事: Linux
関連書籍: node.js