使用npm i -g全局安装mermaid-filter时卡住:安装因弃用警告停滞
npm全局安装mermaid-filter卡住无进展的解决办法
我尝试执行以下命令全局安装mermaid-filter:
npm i -g mermaid-filter
但安装进程卡在中途无法完成——终端先输出多条弃用警告,随后光标无限旋转停滞。最后显示的几行内容如下:
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported npm warn deprecated q@1.5.1: You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other. npm warn deprecated npm warn deprecated (For a CapTP with native promises, see @endo/eventual-send and @endo/captp) npm warn deprecated puppeteer@19.11.1: < 22.8.2 is no longer supported -
此后无任何进展,光标持续旋转。
以下是经过验证的解决建议:
清理npm缓存后重试
缓存损坏可能导致安装流程异常,执行命令清理缓存后重新安装:npm cache clean --force npm i -g mermaid-filter切换国内npm镜像源
网络延迟或访问限制是常见卡住原因,临时使用国内镜像加速安装:npm i -g mermaid-filter --registry=https://registry.npmmirror.com也可以设置默认使用国内镜像,后续安装都能受益:
npm config set registry https://registry.npmmirror.com npm i -g mermaid-filter跳过可选依赖安装
mermaid-filter依赖的puppeteer需要下载Chromium,这一步极易卡住。可以先跳过可选依赖完成安装:npm i -g mermaid-filter --no-optional如果后续mermaid-filter无法正常运行,再单独安装最新版puppeteer:
npm i -g puppeteer@latest升级npm到最新版本
老旧npm版本可能和部分依赖存在兼容性问题,先升级npm再尝试安装:npm i -g npm npm i -g mermaid-filter手动克隆仓库安装
若上述方法均无效,直接从源码仓库手动安装:git clone https://github.com/tj/mermaid-filter.git cd mermaid-filter npm install npm link
内容的提问来源于stack exchange,提问作者Foad S. Farimani
相关产品推荐
相关产品推荐

