I am facing an error that causes a crush on my nodejs application. The error is below:
'
Error: /home/*******/nodevenv/******/12/lib/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node: file too short
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1057:18)
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)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/outdoor1/nodevenv/prescription_server/12/lib/node_modules/bcrypt/bcrypt.js:6:16)
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)
internal/modules/cjs/loader.js:1057
return process.dlopen(module, path.toNamespacedPath(filename));
The application is hosted on CPanel-based shared hosting. The application is running for 6 months without error. But for 2 days the application is not running. I re-installed bcrypt. But nothing changes. The application working fine on my local pc.
It looks as if your bcrypt binary has somehow become corrupted.
What was the result of your attempt to reinstall bcrypt? Where there any errors?
The bcrypt repo at https://github.com/kelektiv/node.bcrypt.js notes that it only works on "stable" releases of NodeJS greater than >= 10.0.0 and more importantly, requires recompilation on the host platform on install. If your host does not have a full build environment installed, you will not be able to compile this module locally.
Assuming you are running the correct version of NodeJS, you could try retrieving the repo directly to your host machine, cd to its directory, and run npm install to install its requirements. Chief among these is the node-pre-gyp which is a helper to ease the compilation of native node modules.
Once you've done this, you should be able to run the install command for bcrypt itself, as described in the repo's package.json file: node-pre-gyp install --fallback-to-build. (Note that, depending on how your host is configured, you might need to add npx to the beginning of that command to properly invoke node-pre-gyp, e.g. npx node-pre-gyp install --fallback-to-build)
Note any errors this throws and share them here as an update to your question. I'm guessing that the install fails during compilation and you missed the error messages involved.
Baring everything else, I'd also ask CPanel support since I am sure this is not a unique problem.
Related
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.
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.
It has been a long time since I programmed using my personal computer. I usually use a work computer. However, yesterday I decided to start working on a new pet project. Well, I went to set up the website in my Vagrant using VirtualBox, and now nvm, npm, and node are all messed up.
Every time I try to run npm install to set-up the node_module in my project, I get this error:
/home/vagrant/.nvm/v0.10.32/lib/node_modules/npm/lib/utils/unsupported.js:27
console.error(`a bug known to break npm. Please update to at least ${r
^
SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at /home/vagrant/.nvm/v0.10.32/lib/node_modules/npm/bin/npm-cli.js:19:21
at Object.<anonymous> (/home/vagrant/.nvm/v0.10.32/lib/node_modules/npm/bin/npm-cli.js:92:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
No matter what I try to do in npm (upgrade it, install, delete, uninstall, etc) it just throws this error.
Could somebody please help me?
The version of npm you have is not supported on Node v0.10.32. In fact Node v0.10 itself is not supported either and projects are actively dropping support it. Most dependencies will want node v4+ these days.
The version of npm you have installed will be available in the VM:
cat /home/vagrant/.nvm/v0.10.32/lib/node_modules/npm/package.json
You will need to manually extract one of the v2 or possibly even a v1 npm release over the files in /home/vagrant/.nvm/v0.10.32/lib/node_modules/npm.
Removing and setting up your nvm v0.10.32 environment again should also take npm back to a working release.
I would guess your Vagrant build does something like an npm install -g npm which would have worked at some stage but now installs the latest, incompatible version.
Use npm install -g npm#2 to stick to a v2.x release
I installed nodejs and am trying to use npm on my Windows machine. I downloaded all the files from nodejs website. I tried to install the latest 4.4.2 version or 5.10.1 version, but I always got error Cannot find module 'readable-stream' when I tried to run commands using npm.
C:\Users\Ealon>node -v
v5.10.1
C:\Users\Ealon>npm -v
module.js:341
throw err;
^
Error: Cannot find module 'readable-stream'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (C:\Users\Ealon\AppData\Roaming\npm\node_modules\npm\node
modules\npmlog\node_modules\are-we-there-yet\index.js:2:14)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
I tried to reinstall it again and again, still could not fix this problem. And the answers in another similar question do not help because I always got error when I tried to run any command using npm. Any help is appreciated. Thanks!
Judging from the line C:\Users\Ealon\AppData\Roaming\npm\node_modules\npm\node
modules\npmlog\node_modules\are-we-there-yet\index.js:2:14 in the stack trace, I believe that you had a global installation of npm which internally had a dependency on are-we-there-yet, which I confirmed has a dependency on readable-stream.
The global installation of npm appears to have been borked, and are-we-there-yet couldn't resolve access to the readable-stream module for some reason (bad install?).
This wasn't getting fixed by re-installing node, which by default installs npm into program files (path similar to C:\Program Files\nodejs\node_modules\npm). I think the global version was getting run, but the version inside program files should be getting run, so wiping out the global installation of npm should hopefully resolve the issue.
I somehow fixed this issue by upgrading npm in Intellij IDEA.
But I still want an expnalation why that problem in my question happened. I will not mark this as the answer.
No need to uninstall node js. When I tried to update my node version, I got this issue & resolved the the same by following below step -
Go to control panel --> uninstall Programs --> select node.js
and click repair.
Had this issue on a Mac. I cloned a project multiple times to handle different branches in parallel. Only one of my cloned repos started having this same issue when I ran npm start. I deleted the repo, cloned it again and nom was running fine again in that repo. Doesn't sound like a global issue to me. No idea what went wrong.
I get the following error when trying to start my server.js which requires the module "userid".
module.js:460
return process.dlopen(module, path._makeLong(filename));
^
Error: Module version mismatch. Expected 46, got 47.
at Error (native)
at Object.Module._extensions..node (module.js:460:18)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/root/backend/node_modules/userid/lib/userid.js:2:15)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
How can I solve this issue?
Not sure of the exact meaning of this error but my fix for this is to delete the node_modules directory and reinstall the required modules with npm install.
The above is a solution for this error showing up in a node project which uses locally installed modules. If there are some global modules that are throwing this error then you might have to reinstall those.
I would try upgrading the module version that causes the issue on package.json.
Another reason of this problem is that you have several different node versions installed at your system and you manage them with nvm. If you run node index.js and if you run sudo node index.js it may results in running different node version.
So if you installed your application modules with npm install and then run application with sudo node index.js you will have Module version mismatch error. In such case make sure with nvm that sudo node... run the same version of node as your application expects.
Also, while fixing initial problem you may have problem with nvm described here Can't use NVM from root (or sudo). One of possible solutions to this issue described in Yoo Matsuo's comment.
I wasn't sure if this should be a stackoverflow or serverfault question.
I installed Meteor's accounts-password module and it worked locally, but broke my app when deployed to the server. Here's the scoop:
I'm running the latest Meteor 1.0.5 locally on OSX (OS just fully updated)
Building with --architecture os.linux.x86_64
Deploying to Ubuntu 14.04.2 LTS x86_64 (just updated)
Running nodejs v0.12.1 (freshly built)
Serving app with nginx v1.4.0
And still getting:
/home/secrethistory/bundle/programs/server/node_modules/fibers/future.js:245
throw(ex);
^
Error: Module did not self-register.
at Error (native)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at bindings (/home/secrethistory/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/node_modules/bindings/bindings.js:74:15)
at Object.<anonymous> (/home/secrethistory/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/bcrypt.js:3:35)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
Any tips or places to look next?
The bcrypt module is platform dependant (as fibers), so you need to remove the package after decompressing the bundle in your server:
rm -R path/to/bcrypt
then install it again:
npm install bcrypt
As of Meteor 1.0.5 (and this also applies to the forthcoming 1.1), we have not yet gone through the full testing, validation, and QA process with Node 0.12. I would recommend sticking with Node 0.10 until that point. While it is likely that it will mostly work, it's possible that some core changes will be necessary, and as you've seen, binary packages built against the 0.10 ABI don't work with 0.12.
Rebuilding bycrypt from souce fixed the problem of mine
npm rebuild bcrypt --build-from-source