我是Heroku的新手
我一直在尝试将我的应用程序部署到Heroku,但是遇到无法解决的问题
我的构建通过并且应用已部署,但是有一个我找不到也无法解决的错误
由于我对Heroku完全陌生,因此我不确定自己在哪里寻找或寻找什么 这是我的构建日志
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): 12.x
engines.npm (package.json): 6.x
Resolving node version 12.x...
Downloading and installing node 12.18.3
Bootstrapping npm 6.x (replacing 6.14.6)...
npm 6.x installed
-----> Restoring cache
- node_modules
-----> Installing dependencies
Installing node modules
added 39 packages in 1.246s
-----> Build
-----> Caching build
- node_modules
-----> Pruning devDependencies
audited 39 packages in 0.584s
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
-----> Build succeeded!
-----> Discovering process types
Procfile declares types -> (none)
Default types for buildpack -> web
-----> Compressing...
Done: 23.4M
-----> Launching...
Released v5
https://ferit-virtual-classroom.herokuapp.com/ deployed to Heroku
这是我的package.json
{
"name": "ferit-bot",
"version": "1.0.0",
"description": "",
"publishConfig": { "registry": "https://npm.pkg.github.com/" },
"author": "JaVolimKatarinu",
"license": "ISC",
"dependencies": {
"discord.js": "^12.1.1",
"mysql2": "^2.1.0",
"node-fetch-npm": "^2.0.4"
},
"engines":{
"node": "12.x",
"npm": "6.x"
},
"scripts": {
"start": "main.js"
}
}
我在Heroku support上搜索了可能的答案,但没有任何运气
感谢您的阅读,非常感谢您提供有用的答案
编辑:很好,我已经设法部署了该应用程序并正常工作
感谢帮助
答案 0 :(得分:0)
package-json文件中的脚本未正确设置。 必须始终有一个启动命令,该命令可以在终端中运行,但对于您而言,脚本应该是
"scripts": {
"start": "node main.js"
}
节点关键字被忽略,这就是为什么?
答案 1 :(得分:0)
您添加了Procfile吗?
web: node main.js