8

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

cinqS
  • 1,175
  • 4
  • 12
  • 32
  • dear god, upgrade your npm. _please_. – strugee May 10 '16 at 04:34
  • 3
    @strugee yesterday, yes, dear god, for a senior developer, you may know this is an naive problem, but it really stuck me in the situation for a while. pay more patience to the fresher, after all, you came through that stage. and what's more, this is why we have SO, isn't it? – cinqS May 11 '16 at 14:26
  • 1
    yeah, I left that comment before I read your answer - I was assuming the problem was unrelated, and I was just making a drive-by suggestion. sorry about that :) – strugee May 19 '16 at 21:17

2 Answers2

18

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.

cinqS
  • 1,175
  • 4
  • 12
  • 32
0

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"**
Abdelaziz
  • 1
  • 1
  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. – StevenSiebert Sep 02 '21 at 06:24