본문 바로가기

기타

PowerShell 오류 해결법(Starting installation...Please restart this script from an administrative PowerShell!)

문제

 

db연동중에 post내용의 비밀번호를 암호화 하기 위해서 

 

$ npm i bcrypt

bcrypt를 깔려고 했는데 bcrypt는 c++기반이기 때문에 c++이 없는 사람에게는 오류가 생긴다고 한다.

 

그래서 npm 홈페이지를 확인하니

 

$ npm install --global windows-build-tools

위와같은 툴을 설치해주면 정상적으로 사용이 가능하다고 한다.

 

그러나 툴을 설치하려고하니 아래와 같은 수없는 에러가 발생한다(거의 50줄정도)

 

Starting installation...
Please restart this script from an administrative PowerShell!
The build tools cannot be installed without administrative rights.
To fix, right-click on PowerShell and run "as Administrator".
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! windows-build-tools@5.2.2 postinstall: `node ./dist/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the windows-build-tools@5.2.2 postinstall 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\SOL\AppData\Roaming\npm-cache\_logs\2019-12-19T08_16_30_150Z-debug.log

 

위와같은 에러 해결법을 알아보았다.

 

 

 

 

해결법

 

 

첫째, 글로벌 툴이 설치가 안되는 이유는 터미널을 구동시키는 powerShell이 관리자 권한을 얻지 못해서이다.

그래서 우선 cmd창을 관리자권한으로 실행해준다.

 

그 뒤에, 다시한번 아래 명령을 실행해준다.

$ npm install --global windows-build-tools

 

둘째, 툴이 설치가 완료된 후, bcrypt를 설치해줘야하는데 기존 명령어 

 

npm i bcrypt를 실행하니 404 에러가 난다.

 

이런경우에는 아래와 같은 명령어로 실행하면 된다.

 

$ npm i bcrypt@3.0.6

 

위 코드가 안먹히면 아래코드를 추천한다.

 

$ npm i -g node-pre-gyp

 

'기타' 카테고리의 다른 글

티스토리 이미지 경계선 만들기(Tstory image border line)  (0) 2019.12.18