전역 .npmrc prefix 경로 설정을 변경한다. #13
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🐞Error : 로컬 .npmrc 를 설정
현재 npm을 전역에서 관리할 수 있도록 설정을 했었다. 이에 조금 더 욕심을 내서 프로젝트 내에서만 동작할 수 있는 npm관리 설정을 하고 싶어서 프로젝트에
.npmrc
를 설치 했다. 이후 npm config get prefix를 내가 원하는 위치(local_node_modules
)로 설정했으나 전역 path와 충돌하는 일이 발생했다.< 이 경로(
~TrendGarage\local_node_modules
) 문제 이전에는 해당 경로(C:\Users\<userNmae>\.local_node_modules
)로 변경 했으나 동일한 에러가 발생 했다. >물론 registry부분은 따로 설정하지 않았다. 기본적으로 설정될 것이라 예상을 했기 때문이다. 원인을 계속해서 분석하는 중에 문뜩 이런 생각이 들었다. 현재 관리되고 있는
.npm-global
은 새로운 디렉토리기에 내가 원하는 환경을 다시 세팅해야한다는 번거로움으로 로컬에 생성하려고 하는 것 아닌가?전역 npmrc prefix 경로 설정 변경
결국에는 초기에 사용하고 있던 경로(
C:\Users\<userName>\AppData\Roaming\npm
)로 변경을 했다. 과거 사용했던 전역 디렉토리에는 typescript가 존재하지 않아 프로젝트 루트 package에 typescript를 설치했다. 다시 한번 상기하지만 전역 패키지의 실행 파일 경로가 시스템 환경 변수에 추가되어 있어야 npx 없이 명령을 사용할 수 있다. 따라서 로컬 패키지는 npm scripts나 npx로 실행해야 한다.