microsoft / Oryx

Build your repo automatically.
Other
769 stars 176 forks source link

Oryx Pipeline fails when yarn is set to version 4.5.0 #2528

Open MattL-NZ opened 1 month ago

MattL-NZ commented 1 month ago

Bug Report

Pipeline

jobs:
  - job: build_and_deploy_job
    displayName: Build and Deploy Job
    condition: or(eq(variables['Build.Reason'], 'Manual'),or(eq(variables['Build.Reason'], 'PullRequest'),eq(variables['Build.Reason'], 'IndividualCI')))
    pool:
      vmImage: ubuntu-latest
    variables:
      - group: {{hidden}}
    steps:
      - checkout: self
        submodules: true

      - script: |
          corepack enable
          yarn set version 4.5.0
          yarn --version
        displayName: 'Set up Yarn'

      - task: AzureStaticWebApp@0
        inputs:
          azure_static_web_apps_api_token: ${{hidden}}
          app_location: '/'
          api_location: ''
          output_location: ''
        env:
          NEXT_PUBLIC_API_URL: {{hidden}

We are using Node version 20 and Yarn 4.5.0 package.json

"engines": {
    "node": "20.15.1",
    "yarn": "4.5.0"
  },
  "packageManager": "yarn@4.5.0"

We also have the yarn location mentioned in a .yarn.yml file.

yarnPath: .yarn/releases/yarn-4.5.0.cjs
nodeLinker: node-modules

This is the error we are facing.

Using Node version:
v20.15.1

Using Yarn version:
4.5.0

Installing production dependencies in '/b744c23c-6a9c-4fb7-ab4d-83b7d8dd6fd9-swa-oryx/app/.oryx_prod_node_modules'...

Running 'yarn workspaces focus --all || yarn install --production'...

node:internal/modules/cjs/loader:1148
  throw err;
  ^

Error: Cannot find module '/b744c23c-6a9c-4fb7-ab4d-83b7d8dd6fd9-swa-oryx/app/.oryx_prod_node_modules/.yarn/releases/yarn-4.5.0.cjs'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v20.15.1
node:internal/modules/cjs/loader:1148
  throw err;
  ^

Error: Cannot find module '/b744c23c-6a9c-4fb7-ab4d-83b7d8dd6fd9-swa-oryx/app/.oryx_prod_node_modules/.yarn/releases/yarn-4.5.0.cjs'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v20.15.1

Does anyone have a way to get around this error?