运行electron运行robotjs版本号不匹配问题解决
运行发现报错版本号不匹配,去降低node版本号,结果发现不是版本号问题
<project>/node_modules/robotjs/build/Release/robotjs.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 57. This version of Node.js requires NODE_MODULE_VERSION 54. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install).
一顿操作下来又报错node-gyp构建错误
node-expat.3.18 install /usr/local/lib/nodejs/node-v14.0.0-linux-x64/lib/node_modules/rnv/node_modules/node-expat node-gyp rebuild gyp ERR! clean error gyp ERR! stack Error: EACCES: permission denied, rmdir 'build' gyp ERR! System Linux 5.3.0-51-generic gyp ERR! command "/usr/local/lib/nodejs/node-v14.0.0-linux-x64/bin/node" "/usr/local/lib/nodejs/node-v14.0.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /usr/local/lib/nodejs/node-v14.0.0-linux-x64/lib/node_modules/rnv/node_modules/node-expat gyp ERR! node -v v14.0.0 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/rnv/node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) npm WARN rnv.29.0 requires a peer of now.3.0 but none is installed. You must install peer dependencies yourself. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! node-expat.3.18 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the node-expat.3.18 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /home/abhishek/.npm/_logs/2020-05-10T08_21_14_099Z-debug.log
解决办法重新删除项目重新npm执行以下命令能解决大部分问题
target是electron版本号
通过打印
console.info(process.versions);
查看
node和abi的对应关系:参见
cnpm rebuild --runtime=electron --target=8.5.5 --disturl=https://atom.io/download/atom-shell --abi=72