gpt4 book ai didi

javascript - 如何将discord.js 安装到你的node.js

转载 作者:行者123 更新时间:2023-11-28 05:31:01 24 4
gpt4 key购买 nike

我一直在遵循指南

https://www.youtube.com/watch?v=N5kG0bI08EQ

在那篇指南中,他们在命令提示符中使用 npm install Discord.js 并取得了成功,但是当我这样做时。我遇到这样的错误

> ref@1.3.2 install D:\Discord\node_modules\ref
> node-gyp rebuild


D:\Discord\node_modules\ref>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:401:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:356:11
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Discord\node_modules\ref
gyp ERR! node -v v6.6.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm WARN install:ref@1.3.2 ref@1.3.2 install: `node-gyp rebuild`
npm WARN install:ref@1.3.2 Exit status 1
D:\Discord
`-- discord.js@9.3.0

npm WARN enoent ENOENT: no such file or directory, open 'D:\Discord\package.json'
npm WARN Discord No description
npm WARN Discord No repository field.
npm WARN Discord No README data
npm WARN Discord No license field.

谁能帮我解释为什么我无法安装它

在 D:\Discord 中我有一个名为discord.js 的文件夹,内容来自https://github.com/Hydrabolt/discord.js/

他的结果: his result

最佳答案

为了成功安装带有语音支持的discord.js node-gyp是必须的。要在 Windows 上安装 node-gyp,最简单的解决方案就是运行
npm install --global --生产 windows-build-tools
然后再次尝试安装步骤。如果失败尝试
npm 安装-g npm
并重新启动计算机。

从错误来看,您似乎正在尝试安装discord.js v6,它已经很长一段时间没有更新,并且可能不再在任何级别上运行。 Discord api 不断变化,更新到 8.1 之类的版本可能是个好主意,这是最后一个版本,向后兼容为 6.0 编写的代码

关于javascript - 如何将discord.js 安装到你的node.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39699596/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com