【发布时间】:2019-06-12 14:44:29
【问题描述】:
当我尝试使用电子构建我的应用程序时,它在 leveldown 库中崩溃
Error: The module '/Users/macosx/Documents/Electron/node_modules/leveldown/build/Release/leveldown.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 67. Please try re-compiling or re-installing
我试过了
rm -rf node_modules/leveldown
npm install
npm rebuild leveldown--update-binary
npm uninstall leveldown
也试过了
我遇到了同样的问题,这里没有提到对我有用。这是>为我工作的:
在运行的 main.js 文件中需要您需要的所有依赖项 电子。 (这对我来说似乎是第一个重要的部分)运行 npm i -D electron-rebuild 添加 electron-rebuild 包 去掉 node-modules 文件夹,以及 packages-lock.json 文件。运行 npm 我 安装所有模块。运行 ./node_modules/.bin/electron-rebuild 到 重建一切运行很重要 ./node_modules/.bin/electron-rebuild 直接在 npm i 之后,否则它 无法在我的 Mac 上运行。
【问题讨论】:
标签: node.js npm electron leveldown