V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Le18ex

stylus 被 npm 删库导致无法安装依赖,以及解决方案

  •  
  •   Le18ex · Jul 23, 2025 · 1503 views
    This topic created in 285 days ago, the information mentioned may be changed or developed.

    今天下午发项目突然发不上去,但是最近也没改过这块,在 npm 里面搜发现找不到这个库了,直接通过地址进去发现已经被官方标记为恶意代码。
    在 stylus 的 github issue 里面说明了已经在申诉了,里面也提供了一些解决方案。

    如果没有用 stylus 写页面,那可以在 package.json 中添加

    "resolutions": {
        "stylus": "npm:[email protected]"
      }, 
    

    如果 package.json 中已经显示的声明了 stylus 包,可以直接把
    "stylus": "^0.54.4", 替换为 "stylus": "https://github.com/stylus/stylus/archive/0.54.4.tar.gz",

    如果 package.json中没有显示声明 stylus ,而是依赖包的依赖包有用到这个,那可以用

    "resolutions": {  
      "stylus": "github:stylus/stylus#0.54.4"  
    },
    

    强制替换依赖包地址。

    resolutions 关键字适用于 yarn 和 pnpm ,如果用的 npm ,需要替换关键字为 overrides

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1002 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 23:50 · PVG 07:50 · LAX 16:50 · JFK 19:50
    ♥ Do have faith in what you're doing.