인프런 커뮤니티 질문&답변

itdeveloper님의 프로필 이미지

작성한 질문수

Slack 클론 코딩[실시간 채팅 with React]

back 디렉토리에 npm i 오류 문의

22.07.21 16:02 작성

·

286

0

안녕하세요.

1강 부터 내용 따라 하던 중 back 디렉토리에 npm i로 설치 시  아래와 같이 에러가 나면서 설치가 되지 않아 문의 드립니다.

감사합니다.

수고하세요.

-------------------------------------------------------------------------------------------------------------------------

npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

npm ERR! code 1

npm ERR! path D:\study\react\sleact\back\node_modules\bcrypt

npm ERR! command failed

npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild

npm ERR! gyp info it worked if it ends with ok

npm ERR! gyp info using node-gyp@9.0.0

npm ERR! gyp info using node@16.15.1 | win32 | x64

npm ERR! gyp info find Python using Python version 3.10.5 found at "C:\Users\lodics\AppData\Local\Programs\Python\Python310\python.exe"

npm ERR! gyp info find VS using VS2019 (16.11.32602.291) found at:

npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"

npm ERR! gyp info find VS run with --verbose for detailed information

npm ERR! gyp info spawn C:\Users\lodics\AppData\Local\Programs\Python\Python310\python.exe

npm ERR! gyp info spawn args [

npm ERR! gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',

npm ERR! gyp info spawn args   'binding.gyp',

npm ERR! gyp info spawn args   '-f',

npm ERR! gyp info spawn args   'msvs',

npm ERR! gyp info spawn args   '-I',

npm ERR! gyp info spawn args   'D:\\study\\react\\sleact\\back\\node_modules\\bcrypt\\build\\config.gypi',

npm ERR! gyp info spawn args   '-I',

npm ERR! gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',

npm ERR! gyp info spawn args   '-I',

npm ERR! gyp info spawn args   'C:\\Users\\lodics\\AppData\\Local\\node-gyp\\Cache\\16.15.1\\include\\node\\common.gypi',

npm ERR! gyp info spawn args   '-Dlibrary=shared_library',

npm ERR! gyp info spawn args   '-Dvisibility=default',

npm ERR! gyp info spawn args   '-Dnode_root_dir=C:\\Users\\lodics\\AppData\\Local\\node-gyp\\Cache\\16.15.1',

npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',

npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\lodics\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.15.1\\\\<(target_arch)\\\\node.lib',

npm ERR! gyp info spawn args   '-Dmodule_root_dir=D:\\study\\react\\sleact\\back\\node_modules\\bcrypt',

npm ERR! gyp info spawn args   '-Dnode_engine=v8',

npm ERR! gyp info spawn args   '--depth=.',

npm ERR! gyp info spawn args   '--no-parallel',

npm ERR! gyp info spawn args   '--generator-output',

npm ERR! gyp info spawn args   'D:\\study\\react\\sleact\\back\\node_modules\\bcrypt\\build',

npm ERR! gyp info spawn args   '-Goutput_dir=.'

npm ERR! gyp info spawn args ]

npm ERR! gyp: Undefined variable module_name in binding.gyp while trying to load binding.gyp

npm ERR! gyp ERR! configure error

npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1

npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:261:16)

npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:527:28)

npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)

npm ERR! gyp ERR! System Windows_NT 10.0.19044

npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"

npm ERR! gyp ERR! cwd D:\study\react\sleact\back\node_modules\bcrypt

npm ERR! gyp ERR! node -v v16.15.1

npm ERR! gyp ERR! node-gyp -v v9.0.0

npm ERR! gyp ERR! not ok

 

npm ERR! A complete log of this run can be found in:

npm ERR!     C:\Users\lodics\AppData\Local\npm-cache\_logs\2022-07-21T07_34_38_266Z-debug-0.log

-------------------------------------------------------------------------------------------------------------------------

답변 3

0

itdeveloper님의 프로필 이미지
itdeveloper
질문자

2022. 07. 21. 16:52

package-lock.json 지우고 npm i 하니 설치가 됐습니다.

다만 아래와 같이 취약점 경고가 뜨긴 했습니다.

감사합니다.

수고하세요.

 

3 high severity vulnerabilities

 

Some issues need review, and may require choosing

a different dependency.

 

 

Run `npm audit` for details.

제로초(조현영)님의 프로필 이미지
제로초(조현영)
지식공유자

2022. 07. 21. 17:39

취약점은 npm audit fix로 수정하시면 됩니다.

0

itdeveloper님의 프로필 이미지
itdeveloper
질문자

2022. 07. 21. 16:43

npm i -g node-gyp 한 후 다시 npm i 를 하였지만 동일해 보이는 에러가 발생 합니다.

npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

npm ERR! code 1

npm ERR! path D:\study\react\sleact\back\node_modules\bcrypt

npm ERR! command failed

npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild

npm ERR! gyp info it worked if it ends with ok

npm ERR! gyp info using node-gyp@9.0.0

npm ERR! gyp info using node@16.15.1 | win32 | x64

npm ERR! gyp info find Python using Python version 3.10.5 found at "C:\Users\lodics\AppData\Local\Programs\Python\Python310\python.exe"

npm ERR! gyp info find VS using VS2019 (16.11.32602.291) found at:

npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"

npm ERR! gyp info find VS run with --verbose for detailed information

npm ERR! gyp info spawn C:\Users\lodics\AppData\Local\Programs\Python\Python310\python.exe

npm ERR! gyp info spawn args [

npm ERR! gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',

npm ERR! gyp info spawn args   'binding.gyp',

npm ERR! gyp info spawn args   '-f',

npm ERR! gyp info spawn args   'msvs',

npm ERR! gyp info spawn args   '-I',

npm ERR! gyp info spawn args   'D:\\study\\react\\sleact\\back\\node_modules\\bcrypt\\build\\config.gypi',

npm ERR! gyp info spawn args   '-I',

npm ERR! gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',

npm ERR! gyp info spawn args   '-I',

npm ERR! gyp info spawn args   'C:\\Users\\lodics\\AppData\\Local\\node-gyp\\Cache\\16.15.1\\include\\node\\common.gypi',

npm ERR! gyp info spawn args   '-Dlibrary=shared_library',

npm ERR! gyp info spawn args   '-Dvisibility=default',

npm ERR! gyp info spawn args   '-Dnode_root_dir=C:\\Users\\lodics\\AppData\\Local\\node-gyp\\Cache\\16.15.1',

npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',

npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\lodics\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.15.1\\\\<(target_arch)\\\\node.lib',

npm ERR! gyp info spawn args   '-Dmodule_root_dir=D:\\study\\react\\sleact\\back\\node_modules\\bcrypt',

npm ERR! gyp info spawn args   '-Dnode_engine=v8',

npm ERR! gyp info spawn args   '--depth=.',

npm ERR! gyp info spawn args   '--no-parallel',

npm ERR! gyp info spawn args   '--generator-output',

npm ERR! gyp info spawn args   'D:\\study\\react\\sleact\\back\\node_modules\\bcrypt\\build',

npm ERR! gyp info spawn args   '-Goutput_dir=.'

npm ERR! gyp info spawn args ]

npm ERR! gyp: Undefined variable module_name in binding.gyp while trying to load binding.gyp

npm ERR! gyp ERR! configure error

npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1

npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:261:16)

npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:527:28)

npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)

npm ERR! gyp ERR! System Windows_NT 10.0.19044

npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"

npm ERR! gyp ERR! cwd D:\study\react\sleact\back\node_modules\bcrypt

npm ERR! gyp ERR! node -v v16.15.1

npm ERR! gyp ERR! node-gyp -v v9.0.0

npm ERR! gyp ERR! not ok

 

npm ERR! A complete log of this run can be found in:

npm ERR!     C:\Users\lodics\AppData\Local\npm-cache\_logs\2022-07-21T07_41_18_908Z-debug-0.log

제로초(조현영)님의 프로필 이미지
제로초(조현영)
지식공유자

2022. 07. 21. 16:44

npm i node-pre-gyp rebuild

이걸 해보세요.

제로초(조현영)님의 프로필 이미지
제로초(조현영)
지식공유자

2022. 07. 21. 16:45

https://www.inflearn.com/questions/388269

동일한 것 같은데 package-lock.json 지우고 npm i 해보세요.

0

제로초(조현영)님의 프로필 이미지
제로초(조현영)
지식공유자

2022. 07. 21. 16:38

npm i -g node-gyp 한 후 다시 npm i 해보세요.