mongodb - Heroku 推送被拒绝失败:npm ERR!404 未找到:事件流@3.3.6。这会导致构建失败
问题描述
我收到错误消息:
Heroku 推送被拒绝未能定义 node.js 节点未在 package.json 中定义
我的应用程序在本地工作,这是一个使用车把的 Express MongoDB。我的 gitignore 里面有 node_modules,奇怪的是我使用的是 nodemon 而不是 node。
包.json:
{
"name": "Jukebox",
"version": "1.1.0",
"engines": {
"node": "11.3.0",
"npm": "6.4.1"
},
"private": true,
"scripts": {
"start": "node ./bin/www",
"dev": "nodemon ./bin/www"
},
"dependencies": {
"cookie-parser": "~1.4.3",
"debug": "~2.6.9",
"dotenv": "^6.1.0",
"express": "~4.16.0",
"hbs": "~4.0.1",
"http-errors": "~1.6.2",
"method-override": "^3.0.0",
"mongoose": "^5.3.6",
"morgan": "~1.9.0",
"nodemon": "^1.18.4"
},
"description": "Jukebox is an app where users can add their favorite songs for others to discover. There will be a maximum number of 32 songs that can be added. When user selects genre the artists of that genre will populate the grid and a button will appear to add artist.",
"main": "app.js",
"repository": {
"type": "git",
"url": "git+https://github.com/chuckderosier/Jukebox.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/chuckderosier/Jukebox/issues"
},
"homepage": "https://github.com/chuckderosier/Jukebox#readme"
}
解决方案
您需要在 package.json 中指定与您正在开发和测试的运行时相匹配的Node.js 版本。
请执行下列操作:
- 在您的 cmd 行类型中:
node --version
并查看您正在使用的 Node 版本。 - 在您的 package.json 中添加一个引擎部分,从步骤 1 中指定您的节点版本。例如类似于以下内容:
"engines": {
"node": "10.3.0"
}
有关更多信息,请查看 Nodejs buildpacks的 Heroku 文档
推荐阅读
- xamarin - 如何扩大活动输入字段(Xamarin)
- java - 在 Scala 中使用 Java 泛型类会引发错误数量的类型参数错误
- sql - 从查询中删除重复行和“无法绑定多部分标识符”错误
- javascript - 这个数字转换成单词有什么问题?
- c# - 检查 .net Framework 1.1 用户控件中是否可见滚动条
- javascript - Ionic3:Base64 To Gallery 插件使应用程序崩溃
- python - python从文件导入函数-未定义全局名称''
- powershell - 关于进入 PS 会话和设置权限的 PowerShell 问题
- javascript - 带参数单击时的 setAttribute
- javascript - 以下排列的哪个“for”循环?