推送被拒绝,无法在 heroku 应用程序上编译 Node.js 应用程序

问题描述

我在 .gitignore 中添加了 node_modules,这不是问题!

如何解决这个错误,因为在引擎中我已经指定了两者的版本。

enter image description here

这是代码

{
  "name": "server","version": "1.0.0","description": "","main": "index.js","engines": {
    "node":"12.6.2","npm":"6.14.4"
  },"scripts": {
    "start": "node index.js"
  },"author": "smeet_kothari","license": "ISC","dependencies": {
    "express": "^4.17.1"
  }
}

这是我的 index.js 文件

enter image description here

以及 index.js 文件代码

const app = express();

app.get('/',(req,res) => {
    res.send({hi:'there'});
});

const PORT = process.env.PORT || 5000;
app.listen(PORT); 
G:\01) Web Development\10) nodejs project\[FreeCourseSite.com] Udemy - Node with React Fullstack Web Development\MailFeed\server>heroku -v
heroku/7.47.7 win32-x64 node-v12.16.2

procfile 也已添加

enter image description here

提前感谢您的解决方案!

解决方法

好像你还没有为项目定义 Procfile,如果仍然没有解决,请先尝试注释命令行中出现的总错误

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...