<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # 使用原生模塊 Electron 同樣也支持原生模塊,但由于和官方的 Node 相比使用了不同的 V8 引擎,如果你想編譯原生模塊,則需要手動設置 Electron 的 headers 的位置。 ## 原生Node模塊的兼容性 當 Node 開始換新的V8引擎版本時,原生模塊可能“壞”掉。為確保一切工作正常,你需要檢查你想要使用的原生模塊是否被 Electron 內置的 Node 支持。你可以在[這里](https://github.com/electron/electron/releases)查看 Electron 內置的 Node 版本,或者使用 `process.version` (參考:[快速入門](https://github.com/electron/electron/blob/master/docs/tutorial/quick-start.md))查看。 考慮到 [NAN](https://github.com/nodejs/nan/) 可以使你的開發更容易對多版本 Node 的支持,建議使用它來開發你自己的模塊。你也可以使用 [NAN](https://github.com/nodejs/nan/) 來移植舊的模塊到新的 Nod e版本,以使它們可以在新的 Electron 下良好工作。 ## 如何安裝原生模塊 如下三種方法教你安裝原生模塊: ### 最簡單方式 最簡單的方式就是通過 [`electron-rebuild`](https://github.com/paulcbetts/electron-rebuild) 包重新編譯原生模塊,它幫你自動完成了下載 headers、編譯原生模塊等步驟: ```sh npm install --save-dev electron-rebuild # 每次運行"npm install"時,也運行這條命令 ./node_modules/.bin/electron-rebuild # 在windows下如果上述命令遇到了問題,嘗試這個: .\node_modules\.bin\electron-rebuild.cmd ``` ### 通過 npm 安裝 你當然也可以通過 `npm` 安裝原生模塊。大部分步驟和安裝普通模塊時一樣,除了以下一些系統環境變量你需要自己操作: ```bash export npm_config_disturl=https://atom.io/download/atom-shell export npm_config_target=0.33.1 export npm_config_arch=x64 export npm_config_runtime=electron HOME=~/.electron-gyp npm install module-name ``` ### 通過 node-gyp 安裝 你需要告訴 `node-gyp` 去哪下載 Electron 的 headers,以及下載什么版本: ```bash $ cd /path-to-module/ $ HOME=~/.electron-gyp node-gyp rebuild --target=0.29.1 --arch=x64 --dist-url=https://atom.io/download/atom-shell ``` `HOME=~/.electron-gyp` 設置去哪找開發時的 headers。 `--target=0.29.1` 設置了 Electron 的版本 `--dist-url=...` 設置了 Electron 的 headers 的下載地址 `--arch=x64` 設置了該模塊為適配64位操作系統而編譯
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看