拒绝Heroku推送失败:npm ERR!404未找到:event-stream@3.3.6.这会导致生成失败



我得到错误:

Heroku推送被拒绝,无法定义package.json 中未定义的node.js节点

我的应用程序在本地工作,这是一个使用手柄的Express MongoDB。我的gitignore中有node_modules,奇怪的是我使用的是nodemon而不是node。

package.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"

}

您需要在包.json中指定一个匹配的Node.js版本您正在用开发和测试的运行时。

执行以下操作:

  1. 在cmd行中键入:node --version,然后查看您使用的Node版本
  2. 在包中添加一个引擎部分。json指定步骤1中的节点版本。例如,类似于以下内容:

"engines": { "node": "10.3.0" }

有关更多信息,请查看Nodejs构建包的Heroku文档

最新更新