简体   繁体   English

有没有办法降级我的npm版本以匹配node-hid库?

[英]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.

相关问题 如何使用 node-hid 库将来自 device.on() 方法的数据响应转换为字符串 - How to convert to string the data response from device.on() method using node-hid library Node-hid模块未在Webworker上自注册 - Node-hid Module did not self-register on webworker 如何卸载最新节点并降级到旧版本 - How to uninstall latest node & downgrade to old version 如何让 NPM 包管理器引用我的库版本? - How to make NPM package manager refer to my version of a library? 如何模仿我的库是节点模块而不上传到NPM? - How to imitate my library is a node module without uploading to the NPM? Node/NPM:如果我升级我的节点版本,我应该重建包锁定文件吗? - Node/NPM: If I upgrade my node version, should I rebuild the package-lock file? npm依赖缠结的网络-我的库要求的软件包版本不同于我的依赖项使用的版本 - npm dependency tangled web - my library requires a different version of a package than one of my dependencies uses 根据节点版本,我可以使用哪个npm版本是否有限制? - Are there constraints on which npm version I can use based on my node version? 如何使用波浪号版本标签通过 CLI 将 NPM 包降级到较旧的次要版本? - How to downgrade NPM package via CLI to an older minor version with using tilde version tag? 如果 NPM 中不存在此库,如何在我的 Node.JS 项目中使用外部 JS 库方法 - How to use external JS library methods in my Node.JS project if this library does not exist in NPM
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM