提问人:Moeez Ramay 提问时间:10/12/2023 最后编辑:Moeez Ramay 更新时间:10/12/2023 访问量:33
在 heroku 上部署 nextjs fronend 和 nodejs 后端错误
Deploying nextjs fronend and nodejs backend on heroku Error
问:
我正在尝试部署这个具有目录的应用程序:在此处输入图像描述
我添加了一个 procfile。但是当我尝试使用命令将其推送到master时:heroku git:remote -a pet-finder-1
git add .
git commit -m "deply
git push heroku master
它给了我错误:
HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/pet-finder-1.git'
我尝试使用这些命令设置构建包:但没有一个有效heroku buildpacks:set heroku/nodejs -a pet-finder-1
更新:
在设置构建包并在根目录下创建package.json后,使用
npm init -y
我收到了以下新错误:
2023-10-12T14:37:35.857549+00:00 app[web.1]: TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
2023-10-12T14:37:35.857551+00:00 app[web.1]: at new NodeError (node:internal/errors:405:5)
2023-10-12T14:37:35.857551+00:00 app[web.1]: at Function.from (node:buffer:333:9)
2023-10-12T14:37:35.857551+00:00 app[web.1]: at Object.<anonymous> (/app/server/apis/upload.js:53:26)
2023-10-12T14:37:35.857552+00:00 app[web.1]: at Module._compile (node:internal/modules/cjs/loader:1256:14)
2023-10-12T14:37:35.857553+00:00 app[web.1]: at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
2023-10-12T14:37:35.857553+00:00 app[web.1]: at Module.load (node:internal/modules/cjs/loader:1119:32)
2023-10-12T14:37:35.857553+00:00 app[web.1]: at Module._load (node:internal/modules/cjs/loader:960:12)
2023-10-12T14:37:35.857553+00:00 app[web.1]: at Module.require (node:internal/modules/cjs/loader:1143:19)
2023-10-12T14:37:35.857554+00:00 app[web.1]: at require (node:internal/modules/cjs/helpers:119:18)
2023-10-12T14:37:35.857554+00:00 app[web.1]: at Object.<anonymous> (/app/server/server.js:10:16) {
2023-10-12T14:37:35.857558+00:00 app[web.1]: code: 'ERR_INVALID_ARG_TYPE'
2023-10-12T14:37:35.857558+00:00 app[web.1]: }
2023-10-12T14:37:35.857558+00:00 app[web.1]:
2023-10-12T14:37:35.857562+00:00 app[web.1]: Node.js v18.18.1
2023-10-12T14:37:35.864610+00:00 app[web.1]: npm notice
2023-10-12T14:37:35.864656+00:00 app[web.1]: npm notice New major version of npm available! 9.8.1 -> 10.2.0
2023-10-12T14:37:35.864812+00:00 app[web.1]: npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.2.0>
2023-10-12T14:37:35.864836+00:00 app[web.1]: npm notice Run `npm install -g [email protected]` to update!
2023-10-12T14:37:35.864909+00:00 app[web.1]: npm notice
2023-10-12T14:37:35.983779+00:00 heroku[web.1]: Process exited with status 1
2023-10-12T14:37:36.004707+00:00 heroku[web.1]: State changed from starting to crashed
这是我package.json:
{
"name": "moeezpetfinder",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server/server.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/moeezramay/FindMyPetPk.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/moeezramay/FindMyPetPk/issues"
},
"homepage": "https://github.com/moeezramay/FindMyPetPk#readme"
}
答: 暂无答案
评论