Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random "'pnpm' is not recognized as an internal or external command" issues in CI workflows (OSOE-980) #118

Open
Piedone opened this issue Jan 29, 2025 · 2 comments · May be fixed by #119
Assignees
Labels
bug Something isn't working

Comments

@Piedone
Copy link
Member

Piedone commented Jan 29, 2025

In various forms, this has plagued CI builds for at least months, but now I could pinpoint it better, after increasing dotnet build verbosity to minimal in Lombiq/Open-Source-Orchard-Core-Extensions#932. We get this randomly during Windows, but possibly sometimes also Ubuntu, builds:

2025-01-28T22:28:31.7782564Z no-path(1,1): error 1: Command failed: pnpm build [C:\a\Open-Source-Orchard-Core-Extensions\Open-Source-Orchard-Core-Extensions\src\Modules\Lombiq.UIKit\Lombiq.UIKit\Lombiq.UIKit.csproj]
2025-01-28T22:28:31.7784235Z   
2025-01-28T22:28:31.7784625Z   'pnpm' is not recognized as an internal or external command,
2025-01-28T22:28:31.7785120Z   
2025-01-28T22:28:31.7785383Z   operable program or batch file.
2025-01-28T22:28:31.7785791Z   Executing "pnpm build"...
2025-01-28T22:28:31.7786120Z   
2025-01-28T22:28:31.7787467Z EXECWITHMUTEX : error : Command failed: pnpm build [C:\a\Open-Source-Orchard-Core-Extensions\Open-Source-Orchard-Core-Extensions\src\Modules\Lombiq.UIKit\Lombiq.UIKit\Lombiq.UIKit.csproj]
2025-01-28T22:28:31.7788859Z   'pnpm' is not recognized as an internal or external command,
2025-01-28T22:28:31.7789317Z   operable program or batch file.
2025-01-28T22:28:31.7789639Z   
2025-01-28T22:28:31.7790287Z       at ChildProcess.exithandler (node:child_process:422:12)
2025-01-28T22:28:31.7791142Z       at ChildProcess.emit (node:events:517:28)
2025-01-28T22:28:31.7791625Z       at maybeClose (node:internal/child_process:1098:16)
2025-01-28T22:28:31.7792251Z       at ChildProcess._handle.onexit (node:internal/child_process:303:5)
2025-01-28T22:28:31.7796995Z C:\a\Open-Source-Orchard-Core-Extensions\Open-Source-Orchard-Core-Extensions\src\Utilities\Lombiq.NodeJs.Extensions\Lombiq.NodeJs.Extensions\build\_NpmDotnetPrebuild.Windows.targets(4,5): error MSB3073: The command "node scripts/run-pnpm-script "C:\a\Open-Source-Orchard-Core-Extensions\Open-Source-Orchard-Core-Extensions\src\Modules\Lombiq.UIKit\Lombiq.UIKit" build" exited with code 1. [C:\a\Open-Source-Orchard-Core-Extensions\Open-Source-Orchard-Core-Extensions\src\Modules\Lombiq.UIKit\Lombiq.UIKit\Lombiq.UIKit.csproj]

For an example, see the https://github.com/Lombiq/Open-Source-Orchard-Core-Extensions/actions/runs/13020677548/attempts/1 build.

I don't think it's only the UI Kit project.

It seems that EnablePnpm target, that's supposed to enable PNPM and thus make the pnpm command available everywhere, is not reliably run before anything that tries to use it.

Lombiq/Orchard-Vue.js#162 might be related.

Jira issue

@Piedone Piedone added the bug Something isn't working label Jan 29, 2025
@github-actions github-actions bot changed the title Random "'pnpm' is not recognized as an internal or external command" issues in CI workflows Random "'pnpm' is not recognized as an internal or external command" issues in CI workflows (OSOE-980) Jan 29, 2025
@sarahelsaig
Copy link
Member

As far back as I can see, EnablePnpm always had IgnoreExitCode="true" (currently here) to "Ignore sporadic errors when this is run by multiple threads at the same time", whatever that means. My guess is whenever the error code is ignored is exactly when pnpm doesn't get enabled, since both happen sporadically. Instead of ignoring the exit code for the target, it should be retried several times until success. Or some kind of locking/synchronization should be implemented.

@Piedone
Copy link
Member Author

Piedone commented Jan 29, 2025

That looks like the issue, and having synchronization looks like the solution. This seems to run before every new build of an NE-using project, so I'd expect it to run at "random" (based on the current dependency tree of the projects in the solution, and the performance of the build machine) times during the build. So, indeed, what may happen is that

Looking at the binary log, attached below, all EnablePnpms have this output, and nothing else:

Preparing [email protected] for immediate activation...

This is correct, but doesn't tell if the activation was successful, since that's in the exit code. So again, what you suggest looks like a good solution, or at least a way to get to a concrete error during PNPM enable.

build-binary-log-.-Windows-X64-windows-2022-8core_a1ee65c8efff.binlog.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants