现象
error https://registry.npmmirror.com/stylus/-/stylus-0.59.0.tgz: Integrity check failed for “stylus” (computed integrity doesn’t match our records, got “sha512-+7Qg6CvpSKU4v7FG4rzgPqAjc69ADkDJ1uX9P1IZl/C16917AYZ+xlJGG9AS1LCEjVqHprgbulR0FsYk+rlokg== sha1-CjJ4kR2lUzOpKs2tg0+8vLb+3XU=”)
解决办法
This error occurs when npm detects a checksum mismatch for the downloaded package stylus@0.59.0"">`stylus@0.59.0`. This typically happens when:
- The package was modified on the registry
- There was a corruption during download
- The registry has inconsistent records
Solutions:
Clear npm cache and retry:
npm cache clean --force rm -rf node_modules package-lock.json npm install
Use a different registry (temporarily):
npm install stylus@0.59.0 --registry=https://registry.npmjs.org
Skip integrity check (not recommended for production):
npm install --no-audit --no-fund --no-optional --no-package-lock --no-shrinkwrap --no-save --ignore-scripts
Try with Yarn (if available):
yarn add stylus@0.59.0
Download manually: //★ 我使用了该方法解决。
- Visit https://registry.npmmirror.com/stylus/-/stylus-0.59.0.tgz
- Save the file and install from local:
npm install ./stylus-0.59.0.tgz
Note: The npmmirror.com (formerly taobao mirror) is generally reliable, but occasional sync issues can cause these mismatches. If the problem persists, consider reporting it to the mirror maintainers.