LoginSignup
14
7

More than 5 years have passed since last update.

npmモジュールをtgzに固めてインストールする

Last updated at Posted at 2014-04-10

npm packというサブコマンドがあるので、それを使うとモジュールをtgzにまとめる事が出来る。(いつの間にこんなサブコマンド出来てたんだ……)

$ npm pack grunt
npm http GET https://registry.npmjs.org/grunt
npm http 304 https://registry.npmjs.org/grunt
grunt-0.4.4.tgz
$ npm install ./grunt-0.4.4.tgz

npm packに適当なモジュール名を渡してあげると、 依存モジュールと一緒にダウンロードしてきてくれて、そのままtgzに固めてくれる。tgz展開したら依存モジュール付いてこなかった……

なのであとはnpm installでtgzを指定してあげればお気楽簡単インストール。

どこか近いサーバにこんな感じでtgzを落としておいて、package.jsonにいい感じに書いておけば良いのかも。

インターネットに接続出来ない環境とか、プロキシに引っかかって接続できない環境とか、通信速度的に難があるとか、まあいろいろなときに使えるんじゃないでしょうか。

経緯とか

14
7
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
14
7