Home > Back-end >  Please try re-compiling or re-installing Nodejs
Please try re-compiling or re-installing Nodejs

Time:11-15

Have upgraded our server from Ubuntu-18.04LTS to Ubuntu-20.04LTS After OS upgrade when I'm trying to start a nodejs application, but I get the below errors.

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 using\nNODE_MODULE_VERSION 57. 
This version of Node.js requires\nNODE_MODULE_VERSION 64. 
Please try re-compiling or re-installing\nthe 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 generated\n'
$ nodejs --version
v10.19.0

How do i re-compile without losing any existing application data? Please support. Thanks.

CodePudding user response:

I'm not able to ask more info in comments. But have you tried deleting your node_modules directory and installing afresh using npm install or yarn install? This would not have any impact on your application data, rather just the node modules.

But if it's an electron project or similar, try running npm i -D electron-rebuild, following that do the above mentioned step.

  • Related