{
    "componentChunkName": "component---src-templates-blog-post-jsx",
    "path": "/post/how-to-install-nodegit-with-electron/",
    "result": {"data":{"site":{"siteMetadata":{"title":"WEB EGG","author":"Leko - CTO at Yuimedi"}},"markdownRemark":{"id":"dfa5c7fa-6458-5b83-9ccd-3200b33218e8","excerpt":"Electronでnodegitを使おうとして、どの参考記事も助けにならなかったので記事を残します。 今回はこの原因だっただけでまた将来的には別の原因でどハマりする可能性があります。 結論：助けにならなかった情報 electron/docs/tutorial/using-native-node-modules.md…","html":"<p>Electronでnodegitを使おうとして、どの参考記事も助けにならなかったので記事を残します。<br>\n今回はこの原因だっただけでまた将来的には別の原因でどハマりする可能性があります。</p>\n<!--more-->\n<h2 id=\"結論助けにならなかった情報\" style=\"position:relative;\"><a href=\"#%E7%B5%90%E8%AB%96%E5%8A%A9%E3%81%91%E3%81%AB%E3%81%AA%E3%82%89%E3%81%AA%E3%81%8B%E3%81%A3%E3%81%9F%E6%83%85%E5%A0%B1\" aria-label=\"結論助けにならなかった情報 permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>結論：助けにならなかった情報</h2>\n<ul>\n<li><a href=\"https://github.com/atom/electron/blob/master/docs/tutorial/using-native-node-modules.md\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">electron/docs/tutorial/using-native-node-modules.md</a></li>\n<li><a href=\"https://github.com/nodegit/nodegit/issues/574\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Doesn’t work with Electron</a></li>\n<li><a href=\"http://b.amberfrog.net/post/119528788216/electron%E3%81%ABnodegit%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%97%E3%82%88%E3%81%86%E3%81%A8%E3%81%97%E3%81%A6%E3%83%8F%E3%83%9E%E3%81%A3%E3%81%9F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">ElectronにNodeGitをインストールしようとしてハマった</a></li>\n</ul>\n<p>これらの情報は古くなっているのか、そのままの方法でやっても全くうまくいく気配がありませんでした。<br>\n手元のNodeが4なので0.12に戻してみたり、色々やってみたのですが結局ダメ。</p>\n<h2 id=\"結論助けになった情報\" style=\"position:relative;\"><a href=\"#%E7%B5%90%E8%AB%96%E5%8A%A9%E3%81%91%E3%81%AB%E3%81%AA%E3%81%A3%E3%81%9F%E6%83%85%E5%A0%B1\" aria-label=\"結論助けになった情報 permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>結論：助けになった情報</h2>\n<ul>\n<li><a href=\"https://github.com/nodegit/nodegit/issues/686\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Nodegit build fails with Electron 0.31.x / 0.32.x</a></li>\n</ul>\n<blockquote>\n<p>Upgrade notice: (from the above link)<br>\nMost native modules are broken because of io.js upgrade, modules writers need to use NAN v2 to rewrite the modules.</p>\n</blockquote>\n<p>これが答えでした。<br>\nElectronで後方互換のないバージョンアップが行われたようです。</p>\n<h2 id=\"原因まとめ\" style=\"position:relative;\"><a href=\"#%E5%8E%9F%E5%9B%A0%E3%81%BE%E3%81%A8%E3%82%81\" aria-label=\"原因まとめ permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>原因まとめ</h2>\n<ol>\n<li><a href=\"https://github.com/atom/electron/releases/tag/v0.31.0\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Electronの0.31.0でiojs2からiojs3へバージョンアップされた</a>\n<ul>\n<li>\n<p>「Most native modules are broken because of io.js upgrade, module writers need to use NAN v2 to rewrite the modules」</p>\n<p>とのことで、多くのネイティブモジュールとの互換性を失ってしまった（<a href=\"https://github.com/nodejs/nan\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NAN</a>というパッケージの互換性がなくなった）</p>\n</li>\n</ul>\n</li>\n<li>nodegitも例にもれず互換性がなくなったモジュールの１つだった\n<ul>\n<li>\n<p>現在リリースされている最新の<a href=\"https://github.com/nodegit/nodegit/blob/v0.4.1/package.json#L73\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">0.4.1ではnanの1に対応している</a></p>\n<p>なので「nan2に対応しなければ動かないよ」に該当し、動かない。</p>\n<p>この互換性の差が具体的にどうビルドの失敗に繋がるのかは未調査。現状そこまで追る気がしない</p>\n</li>\n</ul>\n</li>\n<li><a href=\"https://github.com/nodegit/nodegit/pull/702\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Bump nan to v2</a>のPRによって<a href=\"https://github.com/nodegit/nodegit/commit/9bc60984f8765049b70eb6f84a3276dc96aad419#diff-b9cfc7f2cdf78a7f4b91a753d10865a2\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">対応するnanのバージョンが2.0.9になった</a></li>\n<li>ただしこのコミットはまだリリースされているバージョンには入っていない</li>\n<li>Gitのタグではなくコミットで<code>npm install</code>する方法を探る</li>\n<li><code>npm i -S https://github.com/nodegit/nodegit/tarball/ece6f2413073f4033316a7c36006a586b7bd94ce</code></li>\n</ol>\n<p>で解決しました。</p>\n<h2 id=\"起承転結\" style=\"position:relative;\"><a href=\"#%E8%B5%B7%E6%89%BF%E8%BB%A2%E7%B5%90\" aria-label=\"起承転結 permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>起承転結</h2>\n<p>Issueにまとめてあります。 <span class=\"removed_link\" title=\"https://github.com/Leko/revy/issues/16\">このような感じ</span> になっていました。</p>\n<h2 id=\"バージョン\" style=\"position:relative;\"><a href=\"#%E3%83%90%E3%83%BC%E3%82%B8%E3%83%A7%E3%83%B3\" aria-label=\"バージョン permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>バージョン</h2>\n<p>手元の環境はこのような感じです。</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">$ node -vv0.12.7$ npm -v2.11.3$ $(npm bin)/electron -vv0.32.3</code></pre></div>\n<p>nodejsのバージョンは<code>4.1.1</code>でも試してみましたが、問題なくビルドできました。<br>\nなのでnodejsのバージョンは今回の件に関係ないようです。</p>\n<p>Electronの0.31.*以降を使っている場合、nodegitはリリースされているバージョンではダメで、<br>\nまだリリースされていないmasterのコミットを引っ張ってこないとダメなようです。<br>\nこのコミットの入ったリリースが楽しみです。</p>\n<p>以上、備忘録でした。</p>","timeToRead":4,"frontmatter":{"title":"Electronにnodegitが入らない","tags":["Electron","Git","Nodejs"],"date":"September 24, 2015","featuredImage":null}}},"pageContext":{"slug":"/how-to-install-nodegit-with-electron/","previous":{"fields":{"slug":"/setup-alone-developing-environment-with-github-slack-circleci-codeclimate-and-ci-bundle-update/"},"frontmatter":{"title":"GithubとSlackとCircleCIとCodeClimateとci-bundle-updateでぼっち開発環境を作ってみた","tags":["CI","CircleCI","Code Climate","Git","Github","Ruby","Slack"]}},"next":{"fields":{"slug":"/research-of-log-collection-and-monitoring-in-heroku/"},"frontmatter":{"title":"Herokuでのログ収集と監視について調べてみた","tags":["fluentd","Go","Heroku","Papertrail","TreasureData"]}}}},
    "staticQueryHashes": ["2585454260","2954598359"]}