2

First, I tried installing bcrypt with npm.

Error :

/
> bcrypt@0.8.5 install /home/saaggy18/node-projects/10-projects/node_modules/bcrypt
> node-gyp rebuild

/usr/local/lib/node_modules/npm/bin/node-gyp-bin/node-gyp: 3: /usr/local/lib/node_modules/npm/bin/node-gyp-bin/node-gyp: node: Permission denied
npm ERR! Linux 3.19.0-33-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "bcrypt"
npm ERR! node v4.2.2
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE

npm ERR! bcrypt@0.8.5 install: `node-gyp rebuild`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the bcrypt@0.8.5 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls bcrypt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/saaggy18/node-projects/10-projects/npm-debug.log

Then I found this question

On the 3rd step that is, node-gyp configure

It's hitting an error :

Error: Cannot find module 'nan'
    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 [eval]:1:1
    at Object.exports.runInThisContext (vm.js:54:17)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:435:26)
    at node.js:578:27
    at doNTCallback0 (node.js:419:9)
gyp: Call to 'node -e "require('nan')"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.19.0-33-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/bin/node-gyp" "configure"
gyp ERR! cwd /home/saaggy18/node.bcrypt.js
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v3.2.0
gyp ERR! not ok 

My OS : Elementary Os Freya, which is basically Ubuntu and I have python installed.

Community
  • 1
  • 1
marukobotto
  • 759
  • 3
  • 12
  • 26
  • Try `npm install` in `/home/saaggy18/node.bcrypt.js` - I suspect it will install the dependencies needed to build and run it. – Kenney Nov 29 '15 at 21:13
  • Ya. I did it before. But why is it so frustrating in installing bcrypt unlike others? – marukobotto Nov 29 '15 at 21:16
  • Because it's written in C and must be compiled for your platform.. Oh, one more thing; there's a permission denied error for /usr/local/lib, which usually requires root privileges... – Kenney Nov 29 '15 at 21:20
  • 1
    Did you try `sudo npm install bcrypt` ? I often get errors when I don't install with `sudo`. – John Pink Nov 29 '15 at 21:21
  • Ya I definitely tried that. I use sudo – marukobotto Nov 29 '15 at 21:25
  • In your first attempt, it said there is a `/home/saaggy18/node-projects/10-projects/npm-debug.log` file. Could you re-run your initial attempt, but this time with sudo, and see if such a log file is produced again? – Kenney Nov 29 '15 at 21:29
  • @Kenney Yes, like you said, I re-ran it with sudo. It produced the npm-debug.log file once again. – marukobotto Nov 29 '15 at 21:33
  • Anything interesting in it? – Kenney Nov 29 '15 at 21:37
  • [github](https://github.com/nickB18/user-login-system) Check the log file – marukobotto Nov 29 '15 at 21:45
  • There's a parse error on your `package.json`; remove the last `,` in the file, that should get you at least one step further. – Kenney Nov 30 '15 at 09:42

3 Answers3

3

try to install the build-essential with the command:

sudo apt-get install build-essential

and try again. I hope that will help you

thekingtn
  • 75
  • 5
0

I'd recommend installing node using nvm to save yourself a lot of headache such as this one.

lloyd agola
  • 449
  • 4
  • 5
0

Change Node version and try to install again.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 12 '22 at 20:43