Error: Module did not self-register. - javascript

Server: Ubuntu server 14.04
Node: v4.2.6 LTS
npm: 1.3.10
I pullled my colleage's work from git remote. He made the node_modules as .gitignore. So I have to npm install the modules.
But after a successful install of npm. when I try to start the project using mocha. It remind me of a module didn't self-register
The error comes from the module of Bcrypt.
at bindings (/base_dir/node_modules/bcrypt/node_modules/bindings/bindings.js:76:44)
I don't want to downgrade my node to 0.10, because, I can't use JS promise in that version. Somehow, JS promise is a must in my work

This problem happens mostly because you copied/cloned the repository from somewhere else, but some modules for nodeJS should be installed/registered locally on your machine, during which the happens the build process(maybe some native language like C).
and be noted that the node_modules folder should not be staged for versioning. and should be ignored by versioning tool. and the one who is trying to clone this package should build / install firstly.
I find the answer to this problem.
But plz don't devoted this just because you want.
I upgrade the NPM using
npm install npm -g.
after that, delete the node_modules folder,
then,
npm install
Everything will be good.

I had this issue while setting up my Cypress project.
After trying to delete and then reinstalling all the node-modules and upgrading everything I found out the issue was caused because Cypress uses node from its bundle version by default (which was version 8.0 in my case) , whilst the package I wanted to use required the node version to be 10 or higher.
I did have node 12.0 installed on my machine but since cypress was not using that I had to add the line shown below in the settings file (cypress.json) to set the value for 'nodeVersion' to 'system', this way you are telling cypress explicitly to use the node version installed on your machine.
Add this line to your settings file:
**"nodeVersion": "system"**

Related

Javascript issue installing npm packages (nodemon, express)

I'm new to js and trying to setup a simple project with express and nodemon via npm.
However, installing these packages does give me multiple errors (see below).
I am on Win 10, using the PowerShell & Atom IDE. Project is saved on Google Drive.
"Calc.js" is simply the name of my project.
I have node & npm installed and restarted pc multiple times before.
Then I set up the npm init
I begin to install the first package and get this error:
I try to install express, but get the same result, adding -g also does not make a difference. Now I install "ci", which works for some reason.
Now I have the node modules folder in my project, try to install express again, and it seems to kinda work (got the files in the node_modules folder).
However when I try to run the calc.js via "node calc.js" it
does not work.
Already tried out many things and even accidentally made it work, then tried to reproduce it and failed. Would be super happy for some help.

NPM peer dependencies issue while building vis-timeline locally

I am using vis-timelime in one of my projects. I have done some changes in vis-timeline, then locally build it and using it as dependency in my project. While doing so, vis-timeline is getting installed properly but i believe the peer dependencies of vis-timeline are not coming. Do note that I'm using npm version - 7.6.3.
cd vis-timeline;
//added some console logs in few files
npm install;
npm run build;
Then in my project-
cd my-app
npm install local-path-to-my-vis-timeline
Running above commands install the vis-timeline in node_modules of my-app. However, other peer dependencies of vis-timeline like vis-data, etc. do not come automatically. Since I am using npm version 7.6.3, wasn't it supposed to happen automatically?? If not, any graceful solution to this?
Or let me know of any other better way to locally do changes in vis-timeline library and use it in my local project for debugging.
Sounds like an issue with npm. This post has a list of solutions that might work.
Otherwise, maybe try using yarn instead of npm?

No such file or directory react-native/scripts/libraries

I'm trying to fix this error on github - https://github.com/callstack/react-native-fbads/issues/286 . I cloned the existing repo and ran it and the error was still there. I am currently updating packages to see why this crash keeps happening, but when I try to upgrade to react-native 0.64 from 0.63.4 i get this error in xcode while trying to run on device or simulator:
Projects/ReactNative-FBAds-AdChoicesView-Issue/node_modules/react-native/scripts/../Libraries: No such file or directory
seems like when upgrading to 0.64, the libraries folder is no longer in the scripts folder... Any help would be appreciated. I'm using the same repo as in the link above and then i run npm install -g npm-check-updates
and then ncu -u and then npm install and then cd ios & pod install
(update - 0.63.4 also does not have the libraries folder in there.)
This happened also to me upgrading from 0.63 to 0.64. After trying all solutions I followed a solution moving the folder to a directory where the path contain no spaces and it works and build the app successfully.
Solution to React Native 0.64 build fail
In order for this to work properly follow these steps:
If you previously installed a global react-native-cli package, please
remove it as it may cause unexpected issues (i.e. npm uninstall -g
react-native-cli)
Move the project folder in a path with no spaces (i.e. ~/sub folder
name/ReactNativeApp won't work till you have spaces in the path, so
move in a path like ~/folder/ReactNativeApp)
Then cd into the project folder and upgrade react native to the
latest version with npx react-native upgrade and resolve conflicts if
any
After upgrading remove the node_modules folder and the yarn.lock from
the root and the podfile.lock and Pods folder from ios subfolder
Then cd back to the root and run yarn install && npx pod-install
Now run again your app in Xcode or your IDE and it works
Crazy and absurd that a space in the path-name could cause this issue

Node installed but node cannot be found in Ubuntu VPS

I installed node via NVM. I installed node 0.10.32. using NVM 0.25.0
When I do node -v I get
-bash: /root/.nvm/v0.10.32/bin/node: No such file or directory
when I do npm v I get
/root/.nvm/v0.10.32/bin/npm: 2: exec: /root/.nvm/v0.10.32/bin/node: not found
All those directories exist and node executable is in it but they are reading as not found. Node seems to be installed but I am unable to use it. I am not sure how to fix this issue. Any ideas will be greatly appreciated
Check that your ~/.bash_profile has this:
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
https://github.com/creationix/nvm/issues/576
A lot of things can be wrong here from what you describe. Generally I don't recommend using nvm to install Node on servers. It works fine for your own work on a local machine but when you need to be sure what is installed and where, I recommend doing a real installation.
I recently wrote a tutorial on how to install Node on Linux:
https://gist.github.com/rsp/edf756a05b10f25ee305cc98a161876a
It is specifically about version 6.7.0 but just change the version number to use any other version of Node.
You can see other answers showing how to install Node properly and troubleshoot if it isn't installed correctly:
Run npm as superuser, it isn't a good idea?
node 5.5.0 already installed but node -v fetches with "v4.2.1" on OS X & homebrew?
Just get the binary or source package of the version that you need, install it where you want and it will work. The most reliable way is to install a source package because you can run make test before you install and because npm will have the correct shebang line (which may not always be the case with binary distribution - which, incidentally, is also used by nvm). No need to use nvm or any other tool to do that.
The nvm is great if you need to quickly switch Node versions during development on your local machine but if you want a reliable way to install Node on the server then it's best to install it normally.

Node.js says it can't load sqlite3 module, but does anyway

I'm working with the new Node.js Tools for Visual Studio and included the sqlite3 npm module. When I call require('sqlite3') it throws the error:
Error: Cannot find module './binding\Debug\node-v11-win32-ia32\node_sqlite3.node'
Odd thing is, when I ignore the error and continue running the code, everything works fine...until the function I'm in returns; then the server crashes.
Has anyone else had this issue? I have a suspicion that it has something to do with the ./binding part, but wouldn't know where to begin in terms of finding out why.
use this:-
npm install sqlite3 --build-from-source
This is what worked for me: https://www.npmjs.com/package/sqlite3
npm install https://github.com/mapbox/node-sqlite3/tarball/master
From: https://github.com/mapbox/node-sqlite3/wiki/Building-On-Windows
Install required software:
Python 2.x: https://www.python.org/downloads/release/python-2711/
Win SDK: http://www.microsoft.com/en-us/download/details.aspx?displayLang=en&id=8279
Microsoft Visual Studio 2010+: https://www.microsoft.com/es-es/download/details.aspx?id=48217
Build:
npm install sqlite
npm install
node-gyp configure build
I got the kind of problem, my node version is v10.16.3
This globally installed sqlite3 gives error in loading by require('sqlite3')
It been solved by install a sqlite3 local to project.
$ npm install sqlite3
Note without -g option, it works for me.
It seems this is a problem with the sqlite3 npm package itself. There exists a lib\binding\Release\ folder, but not a lib\binding\Debug\ folder. I just created a copy of the Release folder, named it Debug, and all is well.
In case this above has not worked for anyone, here is what worked for me:
sudo apt install node-sqlite3
(I am using Ubuntu with Vscode as editor). It seems installing this node-sqlite3 module was the one that was recognized.
To skip searching for pre-compiled binaries, and force a build from source, use
npm install --build-from-source

Categories

Resources