1

我正在开发一个节点应用程序。我必须使用robotsjs的地方。当我尝试将包安装到我的节点应用程序时,我遇到了一些错误。

Activating extension 'x' failed: The module '\\? 
\d:\x\app\node_modules\robotjs\build\Release\robotjs.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 75. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`)

我想这可能是因为我的 Node 版本。S0 我将节点版本从 v12.18.3 更改为 v14.9.0。

但是在改变之后,我得到了。

Activating extension 'x' failed: The module 
'\\?\d:\x\app\node_modules\robotjs\build\Release\robotjs.node' 
was compiled against a different Node.js version using NODE_MODULE_VERSION 83. 
This version of Node.js requires NODE_MODULE_VERSION 75. 
Please try re-compiling or re-installing the module (for instance, using `npm rebuild` or `npm 
install`)

在搜索了我的问题后,robotjs我发现了这个robotjs-stackoverflow

但这也不适合我。我试图重建以 NODE_MODULE_VERSION 75 为目标的robotjs 包。仍然是同样的问题。

经过一番挖掘,我发现没有包含NODE_MODULE_VERSION 75的节点版本。检查 NODE_MODULE_VERSION 列。那为什么我会收到错误消息。有什么帮助吗?

4

1 回答 1

4

试试这些方法

1)你必须重建包并告诉 npm 也更新它的二进制文件。尝试:

npm rebuild robotjs --update-binary
  1. 如果它不起作用,您需要从 node_modules 文件夹中删除模块文件夹(robotjs)并重新安装,使用以下命令:

      rm -rf node_modules/robotjs
    
      npm install
    

有关更多信息,请参阅此节点 - 使用 NODE_MODULE_VERSION 51 针对不同的 Node.js 版本进行编译

这是列表 node_module 版本https://nodejs.org/en/download/releases/

3 如果您在Windowsnpm cache clean --force 上,请尝试执行以下步骤

于 2020-09-02T19:28:03.570 回答