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
333 stars 57 forks source link

Local dependency - Error Package "XYZ refers to a non-existing file ... #379

Open E-PressSend opened 3 years ago

E-PressSend commented 3 years ago

Hello,

the build/deployment of my app was working perfectly since this morning when I need to to add a local package as dependency: yarn add file:./ckeditor5

Now my package.json looks like this:

...
"ckeditor5-custom-build": "file:./ckeditor5",
...

The folder ckeditor5 is present correctly in my app root folder as well as in my git repo.

When The workflow run I get the following error message:

Using Node version:
v14.15.1

Using Yarn version:
1.22.10

Installing production dependencies in '/github/workspace/apps/my-app/.oryx_prod_node_modules'...

Running 'yarn install --prefer-offline --production'...

yarn install v1.22.10
[1/4] Resolving packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
error Package "ckeditor5-custom-build" refers to a non-existing file '"/github/workspace/apps/my-app/.oryx_prod_node_modules/ckeditor5"'.

---End of Oryx build logs---
Oryx has failed to build the solution.

This is my action file:

name: Azure Static Web Apps CI/CD

on:
  push:
    branches:
      - main
  pull_request:
    types: [opened, synchronize, reopened, closed]
    branches:
      - main

jobs:
  build_and_deploy_job:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    runs-on: ubuntu-latest
    env:
         CI: ""
    name: Build and Deploy Job
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v0.0.1-preview
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ORANGE_DUNE_015D5D500 }}
          repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
          action: "upload"
          ###### Repository/Build Configurations - These values can be configured to match you app requirements. ######
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
          app_location: "/apps/my-app" # App source code path
          output_location: "build" # Built app content directory - optional
          ###### End of Repository/Build Configurations ######

  close_pull_request_job:
    if: github.event_name == 'pull_request' && github.event.action == 'closed'
    runs-on: ubuntu-latest
    name: Close Pull Request Job
    env:
         CI: ""
    steps:
      - name: Close Pull Request
        id: closepullrequest
        uses: Azure/static-web-apps-deploy@v0.0.1-preview
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ORANGE_DUNE_015D5D500 }}
          action: "close"

Any suggestion?

anthonychu commented 3 years ago

This is an issue with how our build engine Oryx installs dependencies. It copies package.json to another folder before installing. We are investigating how to change this.

Until then, you’ll need to add steps in your workflow before the Static Web Apps action to manually build your app. Then deploy it using:

app_location: /apps/my-app/build
output_location: “”
skip_app_build: true

Related #356

/cc @arroyc

E-PressSend commented 3 years ago

Thanks @anthonychu, now I know what to do :)