programing

캐시를 지운 후 npm이 작동하지 않음

jooyons 2023. 10. 22. 20:02
반응형

캐시를 지운 후 npm이 작동하지 않음

캐시 지우기 전

npm cache clear

npm은 잘 작동합니다.캐시를 지운 후에는 작동하지 않습니다.아래 에러 로그는 인터넷 연결에 문제가 있음을 암시하지만 인터넷 연결은 문제가 없습니다.이 문제는 bower에만 발생하는 것이 아니라 모든 모듈에도 발생합니다.

다음은 프로세스의 출력입니다.

> sudo npm install -g bower Password: npm http GET
> https://registry.npmjs.org/bower npm http GET
> https://registry.npmjs.org/bower npm http GET
> https://registry.npmjs.org/bower npm ERR! network connect ETIMEDOUT
> npm ERR! network This is most likely not a problem with npm itself npm
> ERR! network and is related to network connectivity. npm ERR! network
> In most cases you are behind a proxy or have bad network settings. npm
> ERR! network npm ERR! network If you are behind a proxy, please make
> sure that the npm ERR! network 'proxy' config is set properly.  See:
> 'npm help config'
> 
> npm ERR! System Darwin 12.5.0 npm ERR! command
> "/usr/local/Cellar/node/0.10.16/bin/node" "/usr/local/bin/npm"
> "install" "-g" "bower" npm ERR! cwd /Users/username npm ERR!
> node -v v0.10.16 npm ERR! npm -v 1.3.8 npm ERR! syscall connect npm
> ERR! code ETIMEDOUT npm ERR! errno ETIMEDOUT npm ERR! npm ERR!
> Additional logging details can be found in: npm ERR!    
> /Users/username/npm-debug.log npm ERR! not ok code 0

효과가 있었습니다.

npm cache clean --force 

그럴 것 같네요.

npm cache clean  

https://docs.npmjs.com/cli/cache.html 참조

"npm@5 기준, npm 캐시는 부패 문제로부터 스스로 치유되고 캐시에서 추출된 데이터는 유효성이 보장됩니다.모든 것이 일치하는지 확인하려면 다음을 사용합니다.

npm cache verify

대신에."

이거 드셔보세요.npm cache clean --force그 후에npm cache verify

해라npm cache clean --force작동하지 않으면 %appdata%\npm- cache 폴더를 수동으로 삭제합니다.

인스톨.npm install npm@latest -g

그것은 나에게 효과가 있었다.

이 링크를 방문합니다.

그러려고는 해요.

npm cache clean 

그러나 npm은 npm(> 5)의 새로운 버전이 자가 치유 메커니즘을 가지고 있으며 npm을 확인하기 위해 내가 해야 할 모든 것은 사용 확인이라고 말했습니다.

npm cache verify

npm 메시지:

The npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. 

If you want to make sure everything is consistent, use 'npm cache verify' instead.

그러나 npm을 강제할 경우 다음을 사용합니다.

npm cache clean --force

해라npm cache clean --force작동하지 않으면 수동으로 삭제합니다.%appdata%\npm-cache폴더.

환경 경로가 제거되었을 수 있습니다.

타이핑으로 확인하고,

npm config get prefix

여기가 npm 이진 파일을 찾을 수 있는 위치여야 합니다.

창문에.c:/users/username/AppData/Roaming/npm그들이 발견된 장소입니다.

이 위치를 환경 변수에 추가합니다.잘 될 겁니다.

(제어판 -> '환경변수' 검색 후 해당 이름의 버튼 클릭 -> 경로 편집 -> 위 위치 추가)

npm@6.8.0에서 지원되는 명령어는npm cache verify

cmd를 관리자로 실행하여 이 문제를 해결했습니다. 그 전에는 vs code에서 실행하려고 했습니다.

관리 권한이 있는 PowerShell 또는 Cmd에서 실행합니다.도움이 되기를 바랍니다.

npm install –g @angular/cli@latest
npm cache clean --force 

아니면

npm cache clean 

그 후에

npm cache verify
npm install --cache /tmp/empty-cache
rm C:\Users\<User>\AppData\Local\npm-cache\

언급URL : https://stackoverflow.com/questions/20259492/npm-not-working-after-clearing-cache

반응형