LoginSignup
8
8

More than 5 years have passed since last update.

Node プログラムを Windows 実行形式 (.exe) でパッキング

Last updated at Posted at 2012-02-02

あとでブログ記事に起こすためのメモ変わり。

こういうのパッキングっていうのかな。Node に解釈させる向けに書いた .js なプログラムを、.exe にするような感じ。

実行環境に Node がなくても大丈夫?(要検証)

これを exe 化する

console.log('foo');

github からソースコード取得

msysgit とか Cygwin のとか jgit とかつかう。

> git clone https://github.com/joyent/node.git c:\node

配置や設定

コマンドプロンプトとか。

> cd c:\node
> copy <js までのパス>\foo.js lib\_third_party_main.js
> start node.gyp
  # LF 改行コードを解決してくれるエディタで開く
> type node.gyp
    'library_files': [
      'src/node.js',
      'lib/_debugger.js',
      'lib/_linklist.js',
      'lib/_third_party_main.js',  # ← この行追加!!
      'lib/assert.js',
 ...
> 

ビルド

以下は Visual Studio コマンド プロンプトで実行する

> vcbuild.bat release nosign
 # 警告たくさん出るけどムシムシ
> Release\node.exe
foo
> 

おわり。しかしファイルデカい。

8
8
1

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