Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

NPM basics - Installing Local Packages - problem with installing bcrypt

I keep getting errors when trying to install bcrypt..

I tried npm install bcrypt And npm install bcrypt --python=python2 but nothing seems to work..

Please answer this question since I've seen multiple people having trouble with this.

4 Answers

Zack Jackson
Zack Jackson
30,220 Points

It helps to include the command you are running and the error that comes up in the terminal when asking questions like this.

Is this for a specific project? Did you set up your node_modules folder with "npm init" first? If it's for a specific project that requires bcrypt, I would do the following:

  1. npm init
  2. npm install --save bcrypt

If you want to install bcrypt globally, run npm install -g bcrypt

Thank you for you answer Zack. It's not really for a specific project.

I just wanted to follow along with this tutorial: https://teamtreehouse.com/library/installing-local-packages

Zack Jackson
Zack Jackson
30,220 Points

Serge Zant, are you using workspaces or your terminal?

Following along with the video, are you typing in "npm install bcrypt"? What error are you getting?

Yes i followed along with the video. Actually i get a full list of errors.. In the video the teacher gets a list of errors. I get the same errors.

When the teacher types npm install bcrypt --python=python2, it actually fixes the problem. When I type the exact same line, I still get those errors.

Zack Jackson
Zack Jackson
30,220 Points

Serge Zant , not sure how I can help if you don't tell me what the errors are...

Sounds like maybe you don't have python installed on your machine correctly, but that's a shot in the dark without me fully knowing what errors you have.

Thank you for your help Zack. I'll just continue the course for now and do the first steps again. I'll check if I still get the errors in a few days. Thanks for helping me so far.

I'm having the same issue. It seems like a package or dependency was updated and the video for the course hasn't been updated to account for it.

Running the command npm install bcrypt --python=python2 in the workspace for the course as shown in the video I get these errors:

treehouse:~/workspace$ npm install bcrypt --python=python2                                                                                                                           

> bcrypt@3.0.2 install /home/treehouse/workspace/node_modules/bcrypt                                                                                                                 
> node-pre-gyp install --fallback-to-build                                                                                                                                           

node-pre-gyp WARN Using needle for node-pre-gyp https download                                                                                                                       
node-pre-gyp WARN Pre-built binaries not installable for bcrypt@3.0.2 and node@8.13.0 (node-v57 ABI, glibc) (falling back to source compile with node-gyp)                           
node-pre-gyp WARN Hit error Remote end closed socket abruptly.                                                                                                                       
node-pre-gyp WARN Pre-built binaries not installable for bcrypt@3.0.2 and node@8.13.0 (node-v57 ABI, glibc) (falling back to source compile with node-gyp)                           
node-pre-gyp WARN Hit error bad download                                                                                                                                             
make: Entering directory '/home/treehouse/workspace/node_modules/bcrypt/build'                                                                                                       
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o                                                                                                                           
make: Entering directory '/home/treehouse/workspace/node_modules/bcrypt/build'                                                                                                       
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o                                                                                                                           
rm: cannot remove './Release/.deps/Release/obj.target/bcrypt_lib/src/blowfish.o.d.raw': No such file or directory                                                                    
bcrypt_lib.target.mk:103: recipe for target 'Release/obj.target/bcrypt_lib/src/blowfish.o' failed                                                                                    
make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 1                                                                                                                     
make: Leaving directory '/home/treehouse/workspace/node_modules/bcrypt/build'                                                                                                        
gyp ERR! build error                                                                                                                                                                 
gyp ERR! stack Error: `make` failed with exit code: 2                                                                                                                                
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)                                                                      
gyp ERR! stack     at emitTwo (events.js:126:13)                                                                                                                                     
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)                                                                                                                            
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)                                                                                         
gyp ERR! System Linux 3.10.0-862.14.4.el7.x86_64                                                                                                                                     
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/treehouse/workspace/node_modules/bcr
ypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/home/treehouse/workspace/node_modules/bcrypt/lib/binding" "--napi_version=3" "--node_abi_napi=napi" "--na
pi_build_version=0" "--node_napi_label=node-v57"                                                                                                                                     
gyp ERR! cwd /home/treehouse/workspace/node_modules/bcrypt                                                                                                                           
gyp ERR! node -v v8.13.0                                                                                                                                                             
gyp ERR! node-gyp -v v3.8.0                                                                                                                                                          
gyp ERR! not ok                                                                                                                                                                      
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o                                                                                                                             
node-pre-gyp ERR! build error                                                                                                                                                        
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/treehouse/wo
rkspace/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/treehouse/workspace/node_modules/bcrypt/lib/binding --napi_version=3 --node_abi_
napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)                                                                                                                     
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/treehouse/workspace/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js:83:29)                          
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)                                                                                                                            
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)                                                                                                                   
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:915:16)                                                                                                         
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)                                                                                 
gyp ERR! System Linux 3.10.0-862.14.4.el7.x86_64                                                                                                                                     
gyptreehouse:~/workspace$  ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/b                                                                           
in/node-gyp.js" "build" "--fallback-to-build" "--module=/home/treehouse/workspace/node_modules/bcrypt/lib/                                                                           
binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/home/treehouse/workspace/node_modules/                                                                           
bcrypt/lib/binding" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=                                                                           
node-v57"                                                                                                                                                                            
gyp ERR! cwd /home/treehouse/workspace/node_modules/bcrypt                                                                                                                           
gyp ERR! node -v v8.13.0                                                                                                                                                             
gyp ERR! node-gyp -v v3.8.0                                                                                                                                                          
gyp ERR! not ok                                                                                                                                                                      
treehouse:~/workspace$                                                                                                                                                               
treehouse:~/workspace$ npm install bcrypt --python=python2                                                                                                                           

> bcrypt@3.0.2 install /home/treehouse/workspace/node_modules/bcrypt                                                                                                                 
> node-pre-gyp install --fallback-to-build                                                                                                                                           

node-pre-gyp WARN Using needle for node-pre-gyp https download                                                                                                                       
node-pre-gyp WARN Pre-built binaries not installable for bcrypt@3.0.2 and node@8.13.0 (node-v57 ABI, glibc) (falling back to source compile with node-gyp)                           
node-pre-gyp WARN Hit error Remote end closed socket abruptly.                                                                                                                       
node-pre-gyp WARN Pre-built binaries not installable for bcrypt@3.0.2 and node@8.13.0 (node-v57 ABI, glibc) (falling back to source compile with node-gyp)                           
node-pre-gyp WARN Hit error bad download                                                                                                                                             
make: Entering directory '/home/treehouse/workspace/node_modules/bcrypt/build'                                                                                                       
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o                                                                                                                           
make: Entering directory '/home/treehouse/workspace/node_modules/bcrypt/build'                                                                                                       
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o                                                                                                                           
rm: cannot remove './Release/.deps/Release/obj.target/bcrypt_lib/src/blowfish.o.d.raw': No such file or directory                                                                    
bcrypt_lib.target.mk:103: recipe for target 'Release/obj.target/bcrypt_lib/src/blowfish.o' failed                                                                                    
make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 1                                                                                                                     
make: Leaving directory '/home/treehouse/workspace/node_modules/bcrypt/build'                                                                                                        
gyp ERR! build error                                                                                                                                                                 
gyp ERR! stack Error: `make` failed with exit code: 2                                                                                                                                
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)                                                                      
gyp ERR! stack     at emitTwo (events.js:126:13)                                                                                                                                     
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)                                                                                                                            
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)                                                                                         
gyp ERR! System Linux 3.10.0-862.14.4.el7.x86_64                                                                                                                                     
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/treehouse/workspace/node_modules/bcr
ypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/home/treehouse/workspace/node_modules/bcrypt/lib/binding" "--napi_version=3" "--node_abi_napi=napi" "--na
pi_build_version=0" "--node_napi_label=node-v57"                                                                                                                                     
gyp ERR! cwd /home/treehouse/workspace/node_modules/bcrypt                                                                                                                           
gyp ERR! node -v v8.13.0                                                                                                                                                             
gyp ERR! node-gyp -v v3.8.0                                                                                                                                                          
gyp ERR! not ok                                      

I think that's the full output, selecting and copying from the workspace doesn't seem to be working very smoothly for me.