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
323 stars 55 forks source link

npm fails to install due to old peer dependencies #980

Open joelcoxokc opened 1 year ago

joelcoxokc commented 1 year ago

Describe the bug

As of today. I am unable to deploy using Azure/static-web-apps-deploy@v1 github action.

We are using Angular v14. We are still waiting on a few third party dependencies to upgrade to support Angular v14. Until then we have to run npm install --force | --legacy-peer-deps

This github action runs the install for you which does not use either of those flags. Our system is in production and we are unable to deploy changes do to this. Please fix.

Expected behavior I expect to be able to reference the npm install command. Or allow a "use-legacy-peer-dependencies" flag in the configuration that will tell node to run using that flag.

vivekjilla commented 1 year ago

@joelcoxokc can you see this option unblocks you here: https://github.com/Azure/static-web-apps/issues/369#issuecomment-1309271797

You can set flags (e.g. --legacy-peer-deps) using environment variables. For example: image

cormacpayne commented 1 year ago

@joelcoxokc Hey Joel, sorry for the inconvenience here; in addition to the suggestion above from Vivek, if you are able to, would you mind providing the logs from the unsuccessful workflow execution so I can check where the failure for Oryx is coming from?

joelcoxokc commented 1 year ago

@cormacpayne

App Directory Location: '/' was found.
Looking for event info
Starting to build app with Oryx
Azure Static Web Apps utilizes Oryx to build both static applications and Azure Functions. You can find more details on Oryx here: https://github.com/microsoft/Oryx
Oryx will build app with the following custom override command: npm run build:translator:qa
---Oryx build logs---

Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
You can report issues at https://github.com/Microsoft/Oryx/issues

Oryx Version: 0.2.20221103.1, Commit: a2c65dde152b749fea395f4d1242ea9350942258, ReleaseTagName: 20221103.1

Build Operation ID: |TQfiQ8mSMPQ=.85706e77_
Repository Commit : 65eebedb1deb481eca2e235fc9442bcac744a45a

Detecting platforms...
Detected following platforms:
  nodejs: 16.18.0
  python: 3.9.7
Version '16.18.0' of platform 'nodejs' is not installed. Generating script to install it...
Version '3.9.7' of platform 'python' is not installed. Generating script to install it...
Detected the following frameworks: Angular,Typescript

Source directory     : /github/workspace
Destination directory: /bin/staticsites/ss-oryx/app

Downloading and extracting 'nodejs' version '16.18.0' to '/opt/nodejs/16.18.0'...
Detected image debian flavor: bullseye.
Downloaded in 0 sec(s).
Verifying checksum...
Extracting contents...
performing sha512 checksum for: nodejs...
Done in 1 sec(s).

Downloading and extracting 'python' version '3.9.7' to '/opt/python/3.9.7'...
Detected image debian flavor: bullseye.
Downloaded in 1 sec(s).
Verifying checksum...
Extracting contents...
performing sha512 checksum for: python...
Done in 3 sec(s).

Removing existing manifest file
Creating directory for command manifest file if it does not exist
Creating a manifest file...
Node Build Command Manifest file created.

Using Node version:
v16.18.0

Using Npm version:
8.19.2

Running 'npm install --unsafe-perm'...

npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: jasmine-marbles@0.8.4
npm WARN Found: rxjs@7.5.7
npm WARN node_modules/rxjs
npm WARN   rxjs@"~7.5.0" from the root project
npm WARN   20 more (@angular/cdk, @angular/common, @angular/core, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer rxjs@"^6.5.3" from jasmine-marbles@0.8.4
npm WARN node_modules/jasmine-marbles
npm WARN   jasmine-marbles@"~0.8.4" from @nrwl/angular@14.8.0
npm WARN   node_modules/@nrwl/angular
npm WARN 
npm WARN Conflicting peer dependency: rxjs@6.6.7
npm WARN node_modules/rxjs
npm WARN   peer rxjs@"^6.5.3" from jasmine-marbles@0.8.4
npm WARN   node_modules/jasmine-marbles
npm WARN     jasmine-marbles@"~0.8.4" from @nrwl/angular@14.8.0
npm WARN     node_modules/@nrwl/angular
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: ngx-sortablejs@11.1.0
npm ERR! Found: @angular/common@14.2.3
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"14.2.3" from the root project
npm ERR!   peer @angular/common@"^14.0.1" from @angular-material-components/datetime-picker@8.0.0
npm ERR!   node_modules/@angular-material-components/datetime-picker
npm ERR!     @angular-material-components/datetime-picker@"8.0.0" from the root project
npm ERR!   22 more (@angular-material-components/moment-adapter, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^11.0.0" from ngx-sortablejs@11.1.0
npm ERR! node_modules/ngx-sortablejs
npm ERR!   ngx-sortablejs@"11.1.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @angular/common@11.2.14
npm ERR! node_modules/@angular/common
npm ERR!   peer @angular/common@"^11.0.0" from ngx-sortablejs@11.1.0
npm ERR!   node_modules/ngx-sortablejs
npm ERR!     ngx-sortablejs@"11.1.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /github/home/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /github/home/.npm/_logs/2022-11-10T[13](https://github.com/TaEthni/Web.Clients/actions/runs/3437188269/jobs/5731623775#step:4:14)_[28](https://github.com/TaEthni/Web.Clients/actions/runs/3437188269/jobs/5731623775#step:4:29)_39_[34](https://github.com/TaEthni/Web.Clients/actions/runs/3437188269/jobs/5731623775#step:4:35)8Z-debug-0.log

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

For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/en-us/azure/static-web-apps/
If you believe this behavior is unexpected, please raise a GitHub issue at https://github.com/azure/static-web-apps/issues/
Exiting
cormacpayne commented 1 year ago

@joelcoxokc thanks for providing the above logs -- if the suggestion from Vivek does not work for you, would you mind trying the following: in your app's package.json, would you mind setting the engines.node field to the following:

{
  "name": "...",
  "version": "...",
  ...
  "engines": {
    "node": "14.x"
  }
}

There was a recent change that switched the default version of node used within Static Web Apps to be node 16, updated from the previous node 14, and this change to the engines field will force Oryx to use the latest version of node 14 supported.