package-lock.json將完整性哈希從sha1更改為sha512是什么?

[英]What did package-lock.json change the integrity hash from sha1 to sha512?


I just generated a new npm lockfile, package-lock.json, as part of my typical workflow. But I noticed that this time all of the integrity hashes have been changed from sha1 to sha512. What is happening here?

我剛剛生成了一個新的npm lockfile,package-lock.json,作為我典型工作流程的一部分。但是我注意到這次所有的完整性哈希都從sha1改為sha512。這里發生了什么?

enter image description here

3 个解决方案

#1


26  

From what I can see, npm changed the integrity checksum from sha1 to sha512.

從我所看到的,npm將完整性校驗和從sha1更改為sha512。

If your git changes are going from sha1 to sha512, you should do that update once and it will be good after that.

如果您的git更改從sha1更改為sha512,那么您應該執行一次更新,之后它會更好。

If someone else working with the codebase and sees a git change from sha512 down to sha1 (which is the issue I was having) you can fix it by running the following:

如果其他人使用代碼庫並看到從sha512到sha1的git更改(這是我遇到的問題),您可以通過運行以下命令來修復它:

Discard the changes in git for package-lock.json

丟棄package-lock.json中git的更改

npm i -g npm
rm -rf node_modules/
npm i

This will update npm and reinstall all of your packages so that the new checksum (sha512) is present.

這將更新npm並重新安裝所有包,以便存在新的校驗和(sha512)。

#2


5  

Building on what Dave answered. The fix i found was to do the following:

以戴夫的回答為基礎。我找到的修復方法是執行以下操作:

npm i -g npm

cd {working directory}
rm -rf node_modules/
rm package-lock.json
npm cache clear --force
npm i

We did this for all our developers at the same time and this stopped the sha-512 vs sha-1 issue which was causing frustrating merge conflicts.

我們同時為所有開發人員做了這個,這停止了sha-512 vs sha-1問題,導致令人沮喪的合並沖突。

#3


3  

See also https://github.com/npm/npm/issues/17749 which although claims the issue is 'fixed', it isn't. Removing node_modules is a workaround.

另見https://github.com/npm/npm/issues/17749雖然聲稱問題是“固定的”,但事實並非如此。刪除node_modules是一種解決方法。

There may be a relationship with operating systems. We're hitting this right now with developers on Linux and Windows platforms.

可能與操作系統有關系。我們現在正在與Linux和Windows平台上的開發人員合作。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2017/12/04/72fdef44f3291e2baeafc76c8aaf9608.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com