【发布时间】:2019-08-13 21:49:24
【问题描述】:
当我在 Heroku 上安装 node-opus 和 discord.js 然后通过 heroku run bash 运行 npm list 时,我收到以下警告:
npm 错误! peer dep 缺失:node-opus@^0.2.7,discord.js@11.4.2 需要
我该如何解决这个问题?
这是我的package.json:
{
"name": "PrzegrywBOT",
"description": "PrzegrywBOT",
"version": "2.0.0",
"engines": {
"node": "10.15.0"
},
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"cheerio": "^1.0.0-rc.2",
"discord.js": "^11.4.2",
"ffmpeg": "0.0.4",
"ffmpeg-binaries": "^4.0.0",
"node-opus": "^0.3.1",
"request": "^2.88.0",
"simple-youtube-api": "^5.1.1",
"superagent": "^4.1.0",
"ytdl-core": "^0.29.1"
}
}
【问题讨论】:
-
这不是核心问题,但您是否通过
heroku run bash运行npm i node-opus?即使成功构建,您也无法在 Heroku 上以这种方式安装东西。这是具有自己文件系统的一次性测功机。即使它确实影响了其他测功机,您的更改也会在下次每次测功机重新启动时丢失。您需要添加node-opus作为依赖项,并让 Heroku 在常规 slug 编译期间构建它。 -
我们不会为了理解您的问题而离开现场;它应该是独立的。请edit您的问题并在此处提供相关信息。
-
我刚刚使用 Yarn(使用
package.json和yarn.lock)和使用 NPM(使用package.json和 package-lock.json@987654336)在新的 Heroku 应用上成功安装了node-opus@heroku-18)? Are you using the standardheroku/nodejs` buildpack?(请将相关信息编辑到您的问题中。同样,我们不会离开现场为您挖掘日志。) -
我刚刚启动了一个新的节点应用程序,并且我将 node-opus 作为包中的依赖项,甚至尝试将 npm i node-opus 添加到脚本中,但最终在每个 opus 文件上都给出了警告
warning: this use of "defined" may not be portable [-Wexpansion-to-defined]它尝试在构建过程中安装,并且在构建“成功”之后,当我在 bash npm 列表中输入时,我得到npm ERR! peer dep missing: node-opus@^0.2.7, required by discord.js@11.4.2