본문 바로가기
개발

windows node - node install issue

by deokkk 2022. 6. 27.
반응형

요약

- windows 환경에서 npm install시에

발생하는 이슈입니다.

 

Error

npm ERR! ... `node-gyp rebuild`

Solution

- node -v 확인

- npm -v 확인

 

// node-gyp 설치
npm install --global node-gyp

// case1 (설치가 정상적으로 되는 경우)
// windows-build-tools는 python도 같이 설치된다
npm install --global --production windows-build-tools


// case2 (windows-build-tools가 설치가 멈춘 경우 -> 패키지 매니저 choco 활용)

// choco 설치(cmd 관리자)
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command " [System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

// choco 설치(powershell 관리자)
Get-ExecutionPolicy
Set-ExecutionPolicy AllSigned
Set-ExecutionPolicy Bypass -Scope Process
$ Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

// python visualcpp-build-tools 설치
choco install python visualcpp-build-tools
npm config set msvs_version 2017
반응형

댓글