[英]Is there a way to downgrade my npm version to match the node-hid library?
Using node.js, I wanted to create a kiosk application with a RFID Reader attached to the kiosk. 我想使用node.js创建一个自助服务终端应用程序,并在自助服务终端上附加RFID阅读器。 In order to access my RFID Reader, I installed the node-hid library ( https://github.com/node-hid/node-hid ).
为了访问我的RFID阅读器,我安装了node-hid库( https://github.com/node-hid/node-hid )。 However, when I tried to run the application, an error occured, says:
但是,当我尝试运行该应用程序时,发生了错误,说:
Uncaught Exception Error: The module 'D:\\Projects\\Electron\\SelfService\\node_modules\\node-hid...\\build\\HID.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 72. This version of Node.js required NODE_MODULE_VERSION 73.
未捕获的异常错误:模块'D:\\ Projects \\ Electron \\ SelfService \\ node_modules \\ node-hid ... \\ build \\ HID.node'已使用NODE_MODULE_VERSION 72针对不同的Node.js版本进行了编译。此版本的Node.js需要NODE_MODULE_VERSION 73。
I already updated the library and the node.js version to the latest update, but since the library is kinda old, it doesn't get any more update. 我已经将库和node.js版本更新为最新更新,但是由于该库有点旧,因此不再获得任何更新。
I tried to downgrade the node version, however there aren't any helpful tutorial I can find out there. 我试图降级该节点的版本,但是那里没有任何有用的教程。 I know there are many tutorial that explained how to install the older version of node, but I can't simply know what version of node I need from the error message displayed above.
我知道有很多教程解释了如何安装旧版本的节点,但是从上面显示的错误消息中我无法简单地知道我需要哪个版本的节点。
I need to get the device readable by the application. 我需要使设备可被应用程序读取。 If somehow, it's impossible to use the node-hid library, what is the latest library you recommended to access the RFID Reader from the application?
如果以某种方式,不可能使用节点隐藏库,那么建议从应用程序访问RFID阅读器的最新库是什么?
Note : I'm familiar with web development, including Javascript language, but Node.js is a new experience for me. 注意 :我熟悉Web开发,包括Java语言,但是Node.js对我来说是一种新的体验。 I'll try my best to provide informations regarding my project, but if there are some mistakes with how I described my problem or if I have some difficulties in understanding your answers, please bear with me.
我会尽力提供有关我的项目的信息,但是如果我在描述问题时有一些错误,或者在理解您的答案时遇到困难,请耐心等待。
EDIT : I forgot to mention I'm on Windows 10, the node version I installed is 10.16.3 编辑 :我忘了提到我在Windows 10上,我安装的节点版本是10.16.3
You can uninstall the current node and then re-install the desired node version. 您可以卸载当前节点,然后重新安装所需的节点版本。
But the best practice will be installing node.js using the nvm
aka node version manager
. 但是最佳实践是使用
nvm
aka node version manager
安装nvm
Using nvm
you can easily switch between different node
version as well as different npm
version. 使用
nvm
您可以轻松地在不同的node
版本以及不同的npm
版本之间切换。
Here's a quick start for installing node using
nvm
in both windows, linux and unix platform.这是在Windows,Linux和UNIX平台上都使用
nvm
安装节点的快速nvm
。
NVM Official doc for unix and linux. 用于UNIX和Linux的NVM官方文档 。
NVM alternative for windows Windows的NVM替代
First Try this command - Uninstall the electron first then try below command 首先尝试此命令-先卸载电子,然后再尝试以下命令
sudo npm install --save-dev electron@4.0.0 sudo npm install --save-dev电子@ 4.0.0
sudo npm i --save-dev electron-releases@4.0.0 须藤npm我--save-dev electronic-releases@4.0.0
And also try to update chrome 并尝试更新Chrome
Above is solution be sure minimum using Linux 16.04 with x64 processor and for npm version change see below 以上是解决方案,请确保最低限度使用带x64处理器的Linux 16.04和npm版本更改,请参见下文
For NPM Version Downgrade of Linux/Ubuntu 对于Linux / Ubuntu的NPM版本降级
sudo npm install -g npm@version 须藤npm install -g npm @ version
example- 例-
sudo npm install -g npm@6.9 须藤npm install -g npm@6.9
For Windows - start command prompt administrator 对于Windows-启动命令提示符管理员
npm install -g npm@version npm install -g npm @ version
example- 例-
npm install -g npm@6.9 npm install -g npm@6.9
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.