簡體   English   中英

在放大上部署 NodeJS Express

[英]Deploy NodeJS Express on amplify

我正在嘗試在 AWS Amplify 上部署應用程序。 該應用程序是 React 前端和 NodeJS Express 后端。 前端工作正常,但后端卡在沒有任何合理的解釋

我的 YML 文件是

version: 1
backend:
  phases:
    build:
      commands:
        - npm run build-backend
    postBuild:
        commands:
        - cd ..
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - npm run build-frontend
  artifacts:
    baseDirectory: ./client/build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

構建后端腳本:

"build-backend": "cd server && npm run start",

npm 運行啟動腳本:

"start": "npm install && node index.js"

構建卡在 npm 安裝上,10-20 分鍾后只是“放棄”而沒有以下日志

2021-04-22T11:49:20.693Z [INFO]: > server@1.0.0 start /codebuild/output/src650104622/src/myBlog/server
                                 > npm install && node index.js
2021-04-22T11:49:26.976Z [INFO]: > bcrypt@5.0.0 install /codebuild/output/src650104622/src/myBlog/server/node_modules/bcrypt
                                 > node-pre-gyp install --fallback-to-build

謝謝

我在為我的項目尋找解決方案時遇到了這個線程。 因為這里沒有更多的答案,我會告訴你我自己能找到什么。

Amplify 可與SSG web應用程序(Gatsby 等)、 SSR (React、NextJS、NuxtJS 等)以及簡單的 NodeJS 和 ExpressJS應用程序(僅在請求上運行,因為 Amplify 使用 Lambda 函數來處理它)一起工作。 所以:

PS如果您有關於此主題的任何其他信息,請在此處發布。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM