largoWinch
largoWinch

Reputation: 417

Cannot find module '../build/Release/zmq.node' after Pop-OS/Ubuntu update

I recently updated my operating system, which is Pop-OS, which is a Ubuntu's distribution. Before updating, I could run nodejs with ZeroMQ perfectly. Now, I can't run any file with ZeroMQ, not even with just this SLOC-line: const zmq = require('zeromq')

I am using Visual Studio code and also I tried to uninstall and install from scratch nodejs and npm and nothing works.

This is the error:

myuser@pop-os:~/Documents/Lab/fuentes$ node publicadorServer.js 

 node:internal/modules/cjs/loader:922
  throw err;
 ^

Error: Cannot find module '../build/Release/zmq.node'
Require stack:
- /home/myuser/node_modules/zeromq/lib/index.js
- /home/myuser/node_modules/zeromq/index.js
- /home/myuser/Documents/Lab/fuentes/publicadorServer.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:15)
    at Function.Module._load (node:internal/modules/cjs/loader:763:27)
    at Module.require (node:internal/modules/cjs/loader:991:19)


    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/home/myuser/node_modules/zeromq/lib/index.js:6:11)
    at Module._compile (node:internal/modules/cjs/loader:1102:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
    at Module.load (node:internal/modules/cjs/loader:967:32)
    at Function.Module._load (node:internal/modules/cjs/loader:807:14)
    at Module.require (node:internal/modules/cjs/loader:991:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/myuser/node_modules/zeromq/lib/index.js',
    '/home/myuser/node_modules/zeromq/index.js',
    '/home/myuser/Documents/Lab/fuentes/publicadorServer.js'
  ]
 }

I have installed ZeroMQ with this command at the directory of the project :
npm install zeromq@5

Any help would be appreciated.

Upvotes: 5

Views: 1385

Answers (1)

largoWinch
largoWinch

Reputation: 417

Finally I could fix it, only with the command npm rebuild.

Unbelievable. I guess, installing a new version of node and the new operating system version make necessary to rebuild it, but I still don't understand that, if I uninstall nodejs and npm, why it was not working. Fortunately, it's all fixed.

Upvotes: 2

Related Questions