[英]heroku launches build and gets stuck
日志:
.\yoshi-realese> git push heroku master
Enumerating objects: 2449, done.
Counting objects: 100% (2449/2449), done.
Delta compression using up to 16 threads
Compressing objects: 100% (2353/2353), done.
Writing objects: 100% (2449/2449), 4.63 MiB | 2.71 MiB/s, done.
Total 2449 (delta 275), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Node.js app detected
remote: -----> Build
remote: Running build
remote: > yoshi-v1@1.0.0 build
remote: > nodemon app.js
remote: [nodemon] 2.0.19
remote: [nodemon] to restart at any time, enter `rs`
remote: [nodemon] watching path(s): *.*
remote: [nodemon] watching extensions: js,mjs,json
remote: [nodemon] starting `node app.js`
remote: started yoshistore
之后什么也沒有發生。
這是我的package.json
:
{
"name": "yoshi-v1",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"build": "nodemon app.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"@handlebars/allow-prototype-access": "^1.0.5",
"express": "^4.18.1",
"express-handlebars": "^6.0.6",
"handlebars": "^4.7.7",
"mongoose": "^6.5.1",
"nodemon": "^2.0.19"
}
}
您的構建腳本嘗試運行您的應用程序:
"build": "nodemon app.js"
那不是它的用途。 構建腳本在每次部署時運行一次,當 Heroku 構建您的應用程序時,以生成您的應用程序需要的任何工件。
這可能涉及將 TypeScript 編譯為 JavaScript、縮小代碼、搖樹或一大堆其他事情。 我不確定你的應該是什么,但你可以嘗試完全忽略它。
要運行您的應用程序,Heroku 將查看您的Procfile
。 如果不存在這樣的文件, 它將作為web
進程運行您的啟動腳本。 嘗試相應地更改您的package.json
:
"scripts": {
"start": "node app.js",
"test": "echo \"Error: no test specified\" && exit 1"
}
在這里,我將build
更改為start
,並將nodemon
(這是一個不應在生產中使用的開發工具)與node
交換。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.