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.
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.
Related
I was trying to install some dependancies for jupyter with npm, so it works with javascript. I am currently having trouble, anything I do with npm throws this error :
node:internal/modules/cjs/loader:998
throw err;
^
Error: Cannot find module 'npmlog'
Require stack:
- /usr/share/npm/bin/npm-cli.js
at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
at Module._load (node:internal/modules/cjs/loader:841:27)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at require (node:internal/modules/cjs/helpers:103:18)
at /usr/share/npm/bin/npm-cli.js:22:13
at Object.<anonymous> (/usr/share/npm/bin/npm-cli.js:153:3)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/usr/share/npm/bin/npm-cli.js' ]
}
This same error pops whenever I try to use npm, for anything, even npm version throws it.
I have tried removing npm, nodejs and all their dependancies and installing it again with apt-get, I have also tried to do what was advised in this old issue. I tried using nvm. I tried deleting the usr/bin/node before reinstalling node.
Even this command threw the same error :
npm install -g npm#3.5.4
It might help to know I work on linux mint ? Nothing helped, this error is still there, I can't use npm and I don't understand what's going on... Does anyone has any idea on why that might happen ?
Thank you for your time and have a nice day.
Try clear the npm cache by running npm cache clean --force. This can help resolve issues caused by corrupted cache data.
If you are using linux, make sure you have the correct permissions to install npm packages. You may need to run the command with sudo.
I have downloaded the nodejs repository from nodejs website and I want to install it via node file in bin directory and I want to install it with gdebi or software installer app but the error is: for gdebi and for software installer actually I have checked the permissions and activated them and this is the error while I run npx create-react-app name
internal/modules/cjs/loader.js:818
throw err;
^
Error: Cannot find module 'ini'
Require stack:
- /usr/share/nodejs/#npmcli/config/lib/index.js
- /usr/share/nodejs/npm/lib/utils/config/definition.js
- /usr/share/nodejs/npm/lib/utils/config/definitions.js
- /usr/share/nodejs/npm/lib/utils/config/flatten.js
- /usr/share/nodejs/npm/lib/utils/config/index.js
- /usr/share/nodejs/npm/bin/npx-cli.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/usr/share/nodejs/#npmcli/config/lib/index.js:3:13)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/share/nodejs/#npmcli/config/lib/index.js',
'/usr/share/nodejs/npm/lib/utils/config/definition.js',
'/usr/share/nodejs/npm/lib/utils/config/definitions.js',
'/usr/share/nodejs/npm/lib/utils/config/flatten.js',
'/usr/share/nodejs/npm/lib/utils/config/index.js',
'/usr/share/nodejs/npm/bin/npx-cli.js'
]
}
that's just an archive file, not a debian package so dont try to open it with a package manager
it looks like you downloaded an arm version of nodejs, are you sure you are on arm ?
if you don't need that specific version of nodejs, you can install it threw the command line apt install nodejs -y
just some extra packages remaining from past which I could handle with sudo apt autoremove and sudo apt autoclean then I reinstalled nodejs via terminal
I am following Cordova's Getting Started guide but I'm already stuck at the 2nd step. When I try to create my project by typing cordova create myApp, it fails with the following error message:
C:\Users\foobar\AppData\Roaming\npm\node_modules\cordova\node_modules\queue-microta
sk\index.js:5
? queueMicrotask.bind(globalThis)
^
ReferenceError: globalThis is not defined
at Object.<anonymous> (C:\Users\foobar\AppData\Roaming\npm\node_modules\cordova
\node_modules\queue-microtask\index.js:5:25)
at Module._compile (internal/modules/cjs/loader.js:816:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
at Module.load (internal/modules/cjs/loader.js:685:32)
at Function.Module._load (internal/modules/cjs/loader.js:620:12)
at Module.require (internal/modules/cjs/loader.js:723:19)
at require (internal/modules/cjs/helpers.js:14:16)
at Object.<anonymous> (C:\Users\foobar\AppData\Roaming\npm\node_modules\cordova
\node_modules\run-parallel\index.js:4:24)
at Module._compile (internal/modules/cjs/loader.js:816:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
I guess it's some sort of node or npm version problem. If possible though, I would rather not install a different version of node or npm, because I'm afraid it will break other projects otherwise. My node and npm versions are as follows:
node --version
v11.15.0
npm --version
6.7.0
Just make sure to reinstall the cordova if your node version changed.
And after that, cordova prepare again.
change Node version with Node Version Manager (NVM) to Node version10.X.X.
queueMicrotask don't work with Node version 11.X.X.
https://github.com/feross/queue-microtask/issues/13
As I installed electron 8.2 successfully on my linux, I encountered this error while I ran the cli command:
electron .
/usr/local/lib/node_modules/electron/index.js:14
throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')
^
Error: Electron failed to install correctly, please delete
node_modules/electron and try installing again
at getElectronPath (/usr/local/lib/node_modules/electron/index.js:14:11)
at Object. (/usr/local/lib/node_modules/electron/index.js:18:18)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object. (/usr/local/lib/node_modules/electron/cli.js:3:16)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
Well, it seems the problem is with the usr/local/lib/node_modules/electron folder.
It seemed installed improperly.
So, I copied the node_modules/electron/dist folder in local project and pasted in the global folder mentioned above and :
wooooooooohoooooooooo!!!! solved
I am running a Homestead virtual machine and when I run Gulp I got this error message.
I read so many topics on the web and I tried these, but not working.
vagrant#homestead:~/Code/crm.activix.local$ gulp module.js:339
throw err;
^
Error: Cannot find module '../traversal'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/home/vagrant/Code/crm.activix.local/node_modules/laravel-elixir/node_modules/babelify/node_modules/babel-core/lib/transformation/plugin-pass.js:19:18)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
Homestead and Gulp is a strange thing. I've never gotten it to work properly when running gulp and npm commands inside my Homestead VM.
I use windows, so I have to use gith bash from windows to make gulp/npm stuff work properly. I believe the issue has to do with windows pathing. Take this path from the laravel-elixir install
myproject\node_modules\laravel-elixir\node_modules\gulp-util\node_modules\gulplog\node_modules\glogg\node_modules\sparkles
So dependencies have hteir own dependencies, who have their own dependencies, etc.
When you try to install this, and it has to "mirror" the files on your windows system, it just breaks. At least that's what I think happens.
So to be safe, install node.js on your computer, and run all gulp/npm commands from there. At least that's what I need to do.