Heroku推送拒绝失败:npm ERR!找不到404:[email protected]。这会导致构建失败

卡盘D

我收到错误消息:

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"

}

内森

您需要在package.json指定正在开发和测试运行时相匹配的Node.js版本

请执行下列操作:

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

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

有关更多信息,请查看用于Node.js buildpacks的Heroku文档

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章