본문 바로가기

학습노트/기초지식

npm install bcrypt error 해결 방법

bcrypt 설치시 아래와 같은 오류가 뜬다면 해결하는 방법이 있습니다.

오류 코드

> bcrypt@3.0.6 install D:\Project\test\bb\back\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 Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.6/bcrypt_lib-v3.0.6-node-v72-win32-x64-unknown.tar.gz 

node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.6 and node@12.3.1 (node-v72 ABI, unknown) (falling back to source compile with node-gyp) 

gyp ERR! UNCAUGHT EXCEPTION 

gyp ERR! stack Error: spawn D:\Visual Studio\MSBuild\15.0\Bin\MSBuild.exe ENOENT

gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)

gyp ERR! stack     at onErrorNT (internal/child_process.js:456:16)

gyp ERR! stack     at processTicksAndRejections (internal/process/task_queues.js:84:9)

gyp ERR! System Windows_NT 10.0.18362

gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=D:\\Project\\test\\bb\\back\\node_modules\\bcrypt\\lib\\binding\\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=D:\\Project\\test\\bb\\back\\node_modules\\bcrypt\\lib\\binding" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"

gyp ERR! cwd D:\Project\test\bb\back\node_modules\bcrypt

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! bcrypt@3.0.6 install: `node-pre-gyp install --fallback-to-build`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the bcrypt@3.0.6 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!     C:\Users\User\AppData\Roaming\npm-cache\_logs\2019-10-18T08_33_22_379Z-debug.log

 

 

해결방법

1. cmd를 관리자 권한으로 실행한다.

 

2. npm install --global windows-build-tools

 

3. 원래 경로로 돌아와서 npm install bcrypt@3.0.6 (자기 버전)