2

I'm trying to run a pipeline with Azure, when it comes to build, it fails with this error :

enter image description here

When I run the nx affected --target=build --base=origin/master --prod --parallel command locally, I also have the Another process... message but it doesn't show as an error which lets the build continues. But on Azure it just fails :(

Any idea how I can solve this? Thanks

KevinTale
  • 1,658
  • 3
  • 25
  • 47

2 Answers2

3

This is a known issue with how NGCC runs, you can reference it here:

GitHub Issue 35362

and as a work around add this to your package.json file: (in the script section)

"postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points",

it also appears to be blocking using the --parallel flag. try dropping that.

Flightdoc5242
  • 199
  • 1
  • 2
  • 12
  • Thanks for you reply. Unfortunately, this script is already in my package.json – KevinTale May 28 '20 at 17:03
  • are you running concurrent builds? and have you tried to delete the lock file from node_modules/@angular/compiler-cli/ngcc/ ? – Flightdoc5242 May 28 '20 at 17:27
  • Yes, NX tooling allows to run build on multiple projects at the same time as you can see on the screenshot – KevinTale May 28 '20 at 17:30
  • Well, Im not sure about the lockfile as the scripts run in an Azure agent and not locally – KevinTale May 28 '20 at 17:35
  • ah, i assumed you had access to the node_modules folder , did you try dropping the --parallel flag? – Flightdoc5242 May 28 '20 at 17:50
  • the --parallel flag allows scripts to run in parallel, this is not about concurrent builds... :/ – KevinTale May 28 '20 at 18:02
  • the weird part is that locally the message `Another process...` doesnt show as an error. It does on Azure though. – KevinTale May 28 '20 at 18:04
  • Wait actually it seems to work when removing --parallel, I need to make some tests to check if that is really the thing that make it works because I've changed some other details. Thanks for your time :) – KevinTale May 28 '20 at 18:09
  • np, i also edited the answer above to help others who might run into this problem – Flightdoc5242 May 28 '20 at 18:16
  • Ok so after more investigation, it looks like it has more to do with powershell. I was using `task: PowerShell@2` to use these scripts which led to those errors. I tried with `pwsh` and also just `script:` and it seems to work even with --parallel – KevinTale May 28 '20 at 18:59
  • @GreatHawkeye It seems that you've found the workaround, please consider adding that as answer :) – LoLance May 29 '20 at 06:11
1

After further investigation, I found out the problem was with powershell.

Here is the yaml code I was using :

- task: PowerShell@2
        displayName: 'Running build'
        inputs:
          targetType: 'inline'
          script: 'npm run nx affected -- --target=build --base=origin/master --prod --parallel'

It looks like Powershell exited on this error which doesn't seem to be the case with either cmd.exe or pwsh. Here is the version that works :

- pwsh: 'npm run nx affected -- --target=build --parallel --base=origin/master --prod'
        displayName: 'Running build'
KevinTale
  • 1,658
  • 3
  • 25
  • 47
  • Great! Thanks for sharing your solution here, you could [Accept it as an Answer](https://stackoverflow.com/help/self-answer) , so it could help other community members who get the same issues and we could archive this thread, thanks. – LoLance Jun 02 '20 at 06:03