serialport for electron NODE_MODULE_VERSION error and rebuild does not fix

后端 未结 2 1489
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-25 12:02

OS: win 10 Node.js : v12.18.3 electron: v10.1.1

print version from js program: process.versions.node 12.16.3 process.versions.modules 82

  1. install serialpor

相关标签:
2条回答
  • 2021-01-25 12:36

    I had the same issue this morning. With over 5 hours of troubleshooting the only thing that worked for me was to downgrade electron-rebuild to v2.0.1. I am using node v14.9.0(latest), electron v10.1.1(latest), serialport v9.0.1(latest)

    Looks like they have an issue open: https://github.com/electron/electron-rebuild/issues/404

    0 讨论(0)
  • 2021-01-25 12:38

    i had the same problem. Finally, i can solve this with some steps. Here they are.

    1. install electron-rebuild

    npm install --save-dev electron-rebuild
    

    2. Run some script

    On MacOS, run this

    ./node_modules/.bin/electron-rebuild
    

    On Windows, try:

    .\node_modules\.bin\electron-rebuild.cmd
    

    3. Add start script in package.json

    "rebuild": "electron-rebuild -f -w serialport"
    

    4. Rebuild the project

    npm run rebuild
    

    I hope it will help you. have a nice day.

    0 讨论(0)
提交回复
热议问题