[Error] npm i 실패 해결

김현성·2023년 2월 5일
0
root@MSDN-SPECIAL:~/workspace/sleact/back# npm i
npm ERR! code 1
npm ERR! path /root/workspace/sleact/back/node_modules/bcrypt
npm ERR! command failed
npm ERR! command sh -c -- node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.1.0
npm ERR! gyp info using node@18.12.1 | linux | x64
npm ERR! gyp info find Python using Python version 3.8.10 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/lib/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   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/root/workspace/sleact/back/node_modules/bcrypt/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/root/.cache/node-gyp/18.12.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=/root/.cache/node-gyp/18.12.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/18.12.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/root/workspace/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   '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 (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:284:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 5.15.79.1-microsoft-standard-WSL2
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /root/workspace/sleact/back/node_modules/bcrypt
npm ERR! gyp ERR! node -v v18.12.1
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2023-02-05T15_44_17_531Z-debug-0.log`

해결 방안

오류 내용을 보니 bcrypt가 많이 나와있어서 구글링을 해본 결과
1) Visual Studio 코드로 이동
2) 열기 package.json
3) bcrypt 종속성 삭제 package.json
4) 이제 터미널을 열고 실행 npm install bcrypt
5) Visual Studio 코드 다시 시작(작동하지 않는 경우 항상 좋은 방법 :))
이라고 한다.

npm i bcrypt 입력

root@MSDN-SPECIAL:~/workspace/sleact/back# npm i bcrypt

added 530 packages, and audited 531 packages in 8s

1 package is looking for funding
  run `npm fund` for details

45 vulnerabilities (12 moderate, 27 high, 6 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.

npm i 입력

root@MSDN-SPECIAL:~/workspace/sleact/back# npm i

changed 1 package, and audited 531 packages in 1s

1 package is looking for funding
  run `npm fund` for details

45 vulnerabilities (12 moderate, 27 high, 6 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.

참고
https://github.com/kelektiv/node.bcrypt.js/issues/432

profile
자주 검색하게 되는 내용 기록

0개의 댓글