Node.js 在 Raspberry Pi 零 W 上,依赖项不会自动下载

Node.js on a Raspberry Pi Zero W with dependencies not downloading automatically

我制作了一个 Discord 机器人,我想将它托管在 Pi 上,但是一旦我 node.js 开始工作,我 运行 进入安装了 npm 的墙,但是依赖项不会用它下载。有人可以帮助我吗?

Code

pi@raspberrypi:~/bot $ npm i discord.js
npm WARN deprecated snekfetch@3.6.4: use node-fetch instead
npm WARN discord.js@11.1.0 requires a peer of bufferutil@^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.1.0 requires a peer of erlpack@hammerandchisel/erlpack but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.1.0 requires a peer of node-opus@^0.2.5 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.1.0 requires a peer of opusscript@^0.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.1.0 requires a peer of sodium@^2.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.1.0 requires a peer of libsodium-wrappers@^0.5.1 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.1.0 requires a peer of uws@^0.14.1 but none is installed. You must install peer dependencies yourself.
npm WARN greeter-bot@1.0.0 No repository field.
npm WARN greeter-bot@1.0.0 No license field.

+ discord.js@11.1.0
updated 1 package in 24.205s

首先,我不建议在 Raspberry Pi 上托管 Discord 机器人,但为了与您的问题保持一致,我假设您坚持这样做。

您可以尝试两件事:

如果您安装了 apt,运行 命令 apt install -a,它将安装先前输出中缺少的所有软件包。

第二种方法是手动安装它说缺少的软件包。

转到 npm repository,搜索丢失的包,然后下载它在输出中请求的版本。

希望对您有所帮助!

好吧,我通过首先在我的电脑上将 npms 安装到特定文件夹然后使用 Filezilla 传输它来修复它