Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
329 stars 56 forks source link

API build is using Npm, instead of Yarn #1048

Open rajat1saxena opened 1 year ago

rajat1saxena commented 1 year ago

Describe the bug

Oryx is not picking up Yarn from package.json while building API.

To Reproduce Steps to reproduce the behavior:

  1. I am trying to deploy my open-source project on SWA platform.
  2. The project is a Yarn workspaces based monorepo and the app is a Next.js app.
  3. The workflow is listed here: https://github.com/codelitdev/courselit/blob/workspace-based-resolution/.github/workflows/azure-static-web-apps-gray-meadow-012ce1110.yml
  4. The App gets build correctly but the API is not picking up Yarn as the package manager. It is using NPM only.

GitHub Action Workflow Pipeline: https://github.com/codelitdev/courselit/blob/workspace-based-resolution/.github/workflows/azure-static-web-apps-gray-meadow-012ce1110.yml GitHub Action run result: https://github.com/codelitdev/courselit/actions/runs/3952346891/jobs/6767308358

Expected behavior The API should use Yarn instead of NPM.

vivekjilla commented 1 year ago

Hi @rajat1saxena, In context to nextjs, we're using api build to install production dependencies only, as the nextjs app is already built as part of the app build.

So to force using yarn during api build , can you try passing api_build_command argument and use it to only do something like yarn install --production.

Sorry for the inconvenience, and please let me know if it helps.