LoginSignup
278

More than 5 years have passed since last update.

npmのuninstallコマンドを忘れがちなのでメモ

Posted at

npmのアンインストール時のコマンドについて忘れがちだったのでメモ。

package.jsonの書き換え

--save-devはdevDependenciesからの削除、
--saveはDependenciesからの削除となる。

単純に--saveだとdevDependenciesから削除されないで注意。

devDependenciesからの削除
npm uninstall パッケージ --save-dev
Dependenciesからの削除
npm uninstall パッケージ --save

アンインストール

helpではnpm rmnpm uninstallが表示されているが
アンインストールコマンドとしては以下はすべて利用できる。

npm rm パッケージ
npm uninstall パッケージ
npm r パッケージ
npm remove パッケージ
npm un パッケージ
npm unlink パッケージ

--save-dev,--saveの位置

--save-dev,--saveは人によってこだわりがありそうだが、前後どちらでもよい。

devDependenciesへの登録
npm install --save-dev パッケージ
npm install パッケージ --save-dev
dependenciesへの登録
npm install --save パッケージ
npm install パッケージ --save

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
278