簡體   English   中英

針對不同節點版本編譯的串行端口模塊

[英]Serialport module compiled against different node version

我知道還有另一個類似的問題,但這些答案都不適合我。

這是錯誤:

Uncaught Error: The module '/Users/sheshankshankar/Documents/serial-monitor-app/node_modules/@serialport/bindings/build/Release/bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 70. This version of Node.js requires
NODE_MODULE_VERSION 73. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.func (electron/js2c/asar.js:155)
    at process.func [as dlopen] (electron/js2c/asar.js:155)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:828)
    at Object.func (electron/js2c/asar.js:155)
    at Object.func [as .node] (electron/js2c/asar.js:155)
    at Module.load (internal/modules/cjs/loader.js:645)
    at Function.Module._load (internal/modules/cjs/loader.js:560)
    at Module.require (internal/modules/cjs/loader.js:685)
    at require (internal/modules/cjs/helpers.js:16)
    at bindings (/Users/sheshankshankar/Documents/serial-monitor-app/node_modules/bindings/bindings.js:112)

代碼在這里。 執行以下操作應該安裝它。

git clone https://github.com/GreenBayRules/serial-monitor-app.git
# Go into the repository
cd serial-monitor-app
# Install dependencies
npm install
# Run the app
npm start

但事實並非如此。 我得到那個錯誤。 我嘗試了以下方法:

npm install

npm rebuild

yarn install --force

刪除 node_modules

以及這里的幾乎所有其他答案: Node - 使用 NODE_MODULE_VERSION 51 針對不同的 Node.js 版本編譯

我的節點版本是v10.16.3

我在電子綁定上遇到了同樣的錯誤。node 是針對不同的 Node.js 版本使用 NODE_MODULE_VERSION 72 編譯的。這個版本的 Node.js 需要 NODE_MODULE_VERSION 75。

在 Windows 7 上,使用電子 7。我使用電子生成器解決了它。

我在 package.json 中的腳本

"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"electron": "ng build --base-href ./ && tsc --p electron && electron .",
"pack": "electron-builder --dir",
"dist": "electron-builder"
},

運行“npm run dist”解決了這個問題

首先使用 npm i electron electron-builder 安裝電子和電子構建器,然后在 devdependencies 中移動這個依賴項,然后運行以下腳本

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM