programing tip

`npm install`을 실행하면`ERR!

itbloger 2020. 9. 24. 07:35
반응형

`npm install`을 실행하면`ERR! 코드 EINTEGRITY` (npm 5.3.0)


실행하는 동안이 오류가 발생합니다 sudo npm install. 내 서버에서 npm이 이전에 설치되었습니다. package-lock.json파일 삭제를 시도 하고 실행 npm cache clean --force했지만 작동하지 않습니다.

내 npm 버전은 5.3.0입니다.

오류:

npm ERR! code EINTEGRITY
npm ERR! sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA== integrity checksum failed when using sha512: wanted sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA== but got sha512-WXI95kpJrxw4Nnx8vVI90PuUhrQjnNgghBl5tn54rUNKZYbxv+4ACxUzPVpJEtWxKmeDwnQrzjc0C2bYmRJVKg==. (65117 bytes)

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2017-11-29T05_33_52_182Z-debug.log

참조 https://github.com/npm/npm/issues/16861를

이것은 나를 위해 일했습니다.
npm cache verify

그런 다음 다시 실행했습니다.
npm install -g create-react-app

예상대로 설치되었습니다. 문제가 해결되었습니다.


github 문제에 언급 된 다른 솔루션은 다음과 같습니다.

npm cache clean --force

또는

Users%username%\AppData\Roaming(Windows 7) 에서 npm 및 npm-cache 폴더 삭제 및 실행npm install

또는

다음을 통해 npm 업데이트 npm i -g npm

또는

지우다 package-lock.json

또는

npm cache verify

또는

npm cache clean

또는

문제를 해결하려면 다음 단계를 수행하십시오.

  1. 모든 오래된 패키지 및 업데이트 테마 찾기 :
    npm outdated -g
    sudo npm i -g outDatedPKG
  2. 다음을 사용하여 npm을 최신 버전으로 업그레이드하십시오.
    sudo npm i -g npm
  3. package-lock.json파일을 삭제 합니다.
  4. _cacache에서 디렉토리 삭제 ~/.npm:npm cache verify
  5. 오류가 발생할 때마다 2 단계와 3 단계를 수행하십시오.
  6. 여전히 오류가 발생하면 npm의 캐시를 지 웁니다.
    npm cache clean --force

또는

  1. 에 프록시 추가 .npmrc~디렉토리 :

proxy=http://localhost:8123
https-proxy=http://localhost:8123

  1. 다시 시도하십시오! 느린 인터넷 연결과 검열로 인해이 추악한 문제가 발생할 수 있습니다.

또는

npm cache clear --force && npm install --no-shrinkwrap --update-binary

또는

npm config set package-lock false


package-lock.json 파일을 삭제하고 설치를 시도하십시오.


실제로 위의 내용은 서버 측의 네트워크 연결과 관련이 있습니다. 서버에서 연결 상태가 좋으면 npm 설치가 잘되고 오류가 발생하지 않았습니다.


내 문제는 두 가지였습니다.

  1. 잘못된 package-lock.json 파일
  2. npm-shrinkwrap.json과 package-lock.json 파일의 존재

내가 한 일은 :

  1. package-lock.json 파일 삭제
  2. npm-shrinkwrap.json 파일 삭제
  3. npm 설치를 다시 실행했습니다 (좋은 패키지 잠금 파일을 다시 생성 함).

내 오류를 수정했습니다!


The issue was indeed in package-lock.json, and after replacing it with a working version from another branch it worked.

What's interesting is seeing the diff:

enter image description here

So there really is some integrity checksum in the package-lock.json to verify that the file you are downloading hasn't been tampered with. It's just that somehow the integrity checksum was replaced in our package-lock.json with a SHA1 instead of a SHA-512 checksum. I have no idea how this happened.


Try the following:

npm cache clean --force

This has worked for me.


There are several valid and helpful responses here, but I would like to add that in my case the simplest solution was:

  1. Delete package-lock.json;
  2. Remove folder AppData\Local\npm\cache or AppData\Roaming\npm\cache;
  3. Remove folder node_modules.staging;
  4. Run npm install again.

After that everything ran smoothly.


As a workaround, follow the below steps:

  1. Go to the project directory
  2. Remove the node_modules directory: rm -rf node_modules
  3. Remove package-lock.json file: rm package-lock.json
  4. Clear the cache: npm cache clean --force
  5. Run npm install --verbose If after following the above steps still the issue exists then please provide us the output of installation command with --verbose.

I had a very similar problem, and in my case it worked by doing:

npm clean

This is the nuclear option since it clears every package from the cache as expained here.


Run the commands below on your project..

npm rm -rf node_modules && npm rm package-lock.json && npm rm -rf ~/.npm && npm install --update-binary --no-shrinkwrap

I was using private npm registry and trying to install private npm module. Logging to npm local registry fixed it (used command npm --add-user)


I was stuck at this for a long time and this is what helped me.

Try this:

npm cache clean --force
npm install --update-binary --no-shrinkwrap

Found this answer after digging into GitHub issues!!


Updating the .npmrc files' entries for scoped and un-scoped packages worked for me. So I ended up using the

npm config set @scope_name:registry SCOPED_REGISTRY_URL

and

npm config set registry PUBLIC_REGISTRY_URL


SherylHohman's answer solved the issue I had, but only after I switched my internet connection. Intitially, I was on the hard-line connection at work, and I switched to the WiFi connection at work, but that still didn't work.

As a last resort, I switched my WiFi to a pocket-WiFi, and running the following worked well:

npm cache verify

npm install -g create-react-app

create-react-app app-name

Hope this helps others.


I am behind my organization's proxy, running the following commands fixed the issue for me

npm config set proxy http://proxy.yourproxydomain.com:port
npm config set https-proxy http://proxy.yourproxydomain.com:port
npm config set strict-ssl false
npm config set registry https://registry.npmjs.org/

We had this problem multiple times in the company I work at. Deleting the node_modules folder from the .nvm folder fixed the problem:

rm -rf ~/.nvm/versions/node/v8.6.0/lib/node_modules

Try this

  Step-1) Delete package-lock.json from root folder.
  Step-2) Delete node_modules folder
  Step-3) run npm install command in root

참고URL : https://stackoverflow.com/questions/47545940/when-i-run-npm-install-it-returns-with-err-code-eintegrity-npm-5-3-0

반응형