[npm] GitHubポジトリからインストールしたパッケージアップデートする方法

1 min read
hiroweb developer

背景

GitHub リポジトリを指定して、npm パッケージをインストールしている。

{
  "dependencies": {
    "@hiro0218/example-icon": "github:hiro0218/example-icon"
  }
}

方法

※他のパッケージの状況も相まって、正しいやり方ではないように思うので、検証が進み次第更新する。

  1. パッケージのバージョン指定部分(github:hiro0218/example-icon)に#1.2.3バージョンを指定する。

    {
      "dependencies": {
        "@hiro0218/example-icon": "github:hiro0218/example-icon#v1.2.3"
      }
    }
    
  2. package-lock.jsonを削除する

  3. npm installする

参考