[英]How to pass flags to nodejs application through npm run-script?
[英]how to configure “npm run-script build” command in Nodejs package.json
我正在嘗試在 AWS EBS 上部署基於 nextjs 的項目,但它無法在服務器上運行腳本“npm run-script build”,因此它會生成基於 nextjs 的構建 package 文件夾並可以運行 app。 這是我的 json。
"scripts": {
"dev": "node server.js",
"build": "next build",
"start": "cross-env NODE_ENV=production node server.js"
}
當我在服務器上部署我的應用程序時,它會出現以下錯誤。
錯誤:在“/var/app/current/.next”目錄中找不到有效的構建。 在啟動服務器之前嘗試使用“下一個構建”構建您的應用程序。
我需要在服務器上運行應用程序之前運行命令“npm run-script build”,但不知道如何實現這一點
簡單地說,我們可以一次運行多個命令。
"scripts": {
"dev": "node server.js",
"build": "next build",
"start": "npm-run-script-build && cross-env NODE_ENV=production node server.js"
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.