现象

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:

  1. The package was modified on the registry
  2. There was a corruption during download
  3. The registry has inconsistent records

Solutions:

  1. Clear npm cache and retry:

    npm cache clean --force
    rm -rf node_modules package-lock.json
    npm install
  2. Use a different registry (temporarily):

    npm install stylus@0.59.0 --registry=https://registry.npmjs.org
  3. Skip integrity check (not recommended for production):

    npm install --no-audit --no-fund --no-optional --no-package-lock --no-shrinkwrap --no-save --ignore-scripts
  4. Try with Yarn (if available):

    yarn add stylus@0.59.0
  5. Download manually: //★ 我使用了该方法解决。

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.