LoginSignup
1
3

More than 5 years have passed since last update.

npmには公開されていないパッケージをnpmでインストールする方法

Posted at

メモ書き

bowerにはあるけどnpmにはないパッケージをbowerを使わずにnpmでインストールしたいことがあったので

npmでインストールしたいリポジトリにpackage.jsonがあること
なくてもどうにかできそうだけど

バージョンは指定できない?

やり方

githubのリポジトリの場合
リポジトリの前にgit+
リポジトリの後に.git
をつけて
例) device.jsの場合 リポジトリ(https://github.com/matthewhudson/device.js)

npm install git+https://github.com/matthewhudson/device.js.git --save-dev

インストール完了

自分のpackage.jsonに追加されていることを確認

package.json
"devDependencies": {
  "device.js": "git+https://github.com/matthewhudson/device.js.git"
}

USAGE

main.js
import device from 'device.js'

その他の例

1
3
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
1
3