5

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.

1 Answer 1

2

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.

2
  • 1
    Twice important to share such a piece of experience, that may save days of nightmare for the Community members. Good luck & all the best, @largoWinch - thank you Nov 26, 2020 at 11:28
  • 1
    I had this problem with diskusage. Tried many ways, none worked. npm rebuild has saved my day. Mar 2, 2021 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.