19
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

package.jsonの更新方法 2019年10月版

Last updated at Posted at 2019-10-10

ncuコマンド

package.jsonの更新は、npm-check-updatesを使うのが便利である。
まだ、npm-check-updatesのインストールが終わっていなかったら、

npm i -g npm-check-updates

でグローバルにインストールすることをおすすめする。

package.jsonの更新

以下のコマンドでpackage.jsonを更新することができる。

ncu -u

もし、このコマンドが失敗したらncuのバージョンがが古い場合があるので、

npm update -g npm-check-updates

を実行して更新することをオススメする(何度かハマったことがある)

node_modulesの更新

package.jsonを更新したあとは

npm install

を再度実行すれば良い。
これで一括更新することができる。
(本当は、npm updateするべきなんだろうけれど、npm updateはコケやすいイメージがあり、使っていない)

エラーが出たら、思い切って

rm -rf ./node_modules

して、再インストールしてしまえばいい。

19
17
0

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
19
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?