You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Windows PowerShell安装discord.js时出现错误求助

解决Windows PowerShell安装discord.js时的路径报错问题

我之前在Windows上折腾npm依赖安装时,也碰到过类似的路径相关报错,给你几个亲测有效的排查和解决方向:

  • 清理npm缓存:缓存损坏是这类问题的高发原因,先执行清理命令:

    npm cache clean --force
    

    清理完成后再重新运行npm install discord.js。

  • 删除残留依赖文件:旧的node_modules文件夹或package-lock.json可能会导致依赖冲突,手动删掉这两个内容,然后重新执行安装命令。

  • 提升PowerShell权限:Windows下文件读写权限不足也会触发路径报错,右键点击PowerShell选择「以管理员身份运行」,再执行安装操作试试。

  • 切换npm镜像源:如果是网络问题导致包下载不完整,可以切换到国内镜像源安装:

    npm install discord.js --registry=https://registry.npmmirror.com
    
  • 单独安装报错依赖:既然错误指向async-limiter,可以先单独安装这个包,再安装discord.js:

    npm install async-limiter
    npm install discord.js
    

你的报错示例:

PS C:\Users\kevin\Desktop\Bot> npm install discord.js
npm ERR! path C:\Users\kevin\Desktop\Bot\node_modules\async-limiter n...

内容的提问来源于stack exchange,提问作者NeptuneRG

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 07:43:37