Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript npm Basics Installing Packages with npm Installing Local Packages

NPM not able to install bcrypt

I tried serval times to install bcrypt via npm in the workspace console, but instead of installling the package succesfull I get this error message:

npm ERR! code ENOTFOUND                                                                                                                                                   
npm ERR! errno ENOTFOUND                                                                                                                                                  
npm ERR! network request to https://registery.npmjs.org/bcrypt failed, reason: getaddrinfo ENOTFOUND registery.npmjs.org registery.npmjs.org:443                          
npm ERR! network This is a problem related to network connectivity.                                                                                                       
npm ERR! network In most cases you are behind a proxy or have bad network settings.                                                                                       
npm ERR! network                                                                                                                                                          
npm ERR! network If you are behind a proxy, please make sure that the                                                                                                     
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'                                                                                                  

npm ERR! A complete log of this run can be found in:                                                                                                                      
npm ERR!     /home/treehouse/.npm/_logs/2018-11-02T16_19_43_484Z-debug.log

npm is guessing that the workspace is using a proxy on Threehouses servers, which I have to register in node. Is this true or is there something else causing this error?

Brendan Whiting
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,675 Points

Have you looked at the other questions and answers below the video? It looks like a lot of other people had this problem and there are some solutions.

@Brendan Whiting: Maybe this was a temporary network issue but I am now getting a different error:

> 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.12.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.12.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                                                
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o                                                  
rm: cannot remove './Release/.deps/Release/obj.target/bcrypt_lib/src/blowfish.o.d.raw': No such file or di
rectory                                                                                                   
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:26
2: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/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.12.0                                                                                  
gyp ERR! node-gyp -v v3.8.0                                                                               
gyp ERR! not ok                                                                                           
npm WARN test_npm@0.0.1 No repository field.                                                              

npm ERR! code ELIFECYCLE                                                                                  
npm ERR! errno 1                                                                                          
npm ERR! bcrypt@3.0.2 install: `node-pre-gyp install --fallback-to-build`                                 
npm ERR! Exit status 1                                                                                    
npm ERR!                                                                                                  
npm ERR! Failed at the bcrypt@3.0.2 install script.                                                       
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.        

npm ERR! A complete log of this run can be found in:                                                      
npm ERR!     /home/treehouse/.npm/_logs/2018-11-03T10_20_10_144Z-debug.log

This is not associated with the preceding error. I am getting the same error on my mac. On my windows machine everthing works fine.

This error maybe caused by node-pre-gyp. When installing bcryptjs which is pure javascript npm works properly.