请尝试重新编译或重新安装Nodejs



在OS升级后,当我试图启动nodejs应用程序时,我已经从Ubuntu-18.04LTS to Ubuntu-20.04LTS升级了我们的服务器,但我收到了以下错误。

2021-11-14 10:48:01.641 - error: server-node-1: '[task-manager] 
Error: The module '/home/blruser/mibs/node_modules/weak/build/Release/weakref.node'nwas 
compiled against a different Node.js version usingnNODE_MODULE_VERSION 57. 
This version of Node.js requiresnNODE_MODULE_VERSION 64. 
Please try re-compiling or re-installingnthe module (for instance, using `npm rebuild` or `npm install`).n    at Object.Module._extensions..node (internal/modules/cjs/loader.js:807:18)n    at Module.load (internal/modules/cjs/loader.js:653:32)n    
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)n    
at Function.Module._load (internal/modules/cjs/loader.js:585:3)n    
at Module.require (internal/modules/cjs/loader.js:692:17)n    
at require (internal/modules/cjs/helpers.js:25:18)n    
at bindings (/home/blruser/mibs/node_modules/bindings/bindings.js:81:44)n    
at Object.<anonymous> (/home/blruser/mibs/node_modules/weak/lib/weak.js:7:35)n    
at Module._compile (internal/modules/cjs/loader.js:778:30)n    
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)nWARN: uncaughtException be generatedn'
$ nodejs --version
v10.19.0

如何在不丢失任何现有应用程序数据的情况下重新编译?请支持。谢谢

我无法在评论中询问更多信息。但是您是否尝试过删除node_modules目录并使用npm installyarn install重新安装?这不会对应用程序数据产生任何影响,而只会对节点模块产生任何影响。

但如果是电子项目或类似项目,请尝试运行npm i -D electron-rebuild,然后执行上述步骤。

最新更新