-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix: don't assume commands end with .cmd on Windows #9026
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
base: master
Are you sure you want to change the base?
fix: don't assume commands end with .cmd on Windows #9026
Conversation
🦋 Changeset detectedLatest commit: 883a9f3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
It seems like some tests are currently failing, I'll take a look |
Unfortunately locally on my machine 1/4 of all tests fail (even without these changes), so it's a bit hard right now to debug this. The failures on my machine are totally unrelated to the ones here though. Is there any way to get a Windows environment where these tests run consistently that isn't CI? Normally I'd use a container for this but since we are talking about Windows... |
@Almighty-Alpaca does |
4e2974f
to
785305b
Compare
785305b
to
541b2d8
Compare
@mmaietta thanks that really helped. I learned a few intricacies of I've fixed the implementation to use The downside to this is that now when |
Upon further inspection this doesn't work correctly in all cases yet, I'll try to investigate further As a side note un- and then reinstalling the whole node/npm/yarn/pnpm in different ways for testing slightly different implementations kinda sucks, I don't know of a better way to test this though... |
Yeah, I don't know of another way without committing the node_modules for each test directly to the repo. It was only recently that I added lockfile snapshots to prevent transient dependencies getting version bumped and causing test cases to randomly break. For linux docker tests, you could point mount |
@Almighty-Alpaca do you have a sample repro repo for this that I can take a look at? I can try and help by picking up this PR to work with your setup |
Thanks, that would be awesome. Unfortunately I've been a bit busy with other deadlines and reverted to v26.0.3 for now. Due to this being an environment issue more that a project setup issue I don't have a repro repository, but on Windows you can recreate the problem using one of the examples from the docs, e.g. by running these commands (I tested this in a fresh VM just now, but any Windows machine that doesn't already have any other NodeJS environment installed that could interfere should work): # Install proto https://moonrepo.dev/docs/proto/install#windows
irm https://moonrepo.dev/install/proto.ps1 | iex
& "$HOME\.proto\bin\proto.exe" setup
# If on a fresh machine install Git
winget install git.git
### Reopen terminal here to reload environment variables
# Install Node and Yarn using proto
proto install node latest
proto install yarn latest
# Clone example repo and update electron-builder to problematic version
git clone https://github.com/electron-vite/electron-vite-react
cd electron-vite-react
Add-Content -Value 'nodeLinker: node-modules' -Path .yarnrc.yml # Add Yarn workaround
yarn add --dev electron-builder@26.0.13
# Runs into issue 1 from #9020 as there is no npm installed
yarn build
# Install npm and reinstall packages with npm
proto install npm 10.9.2
Remove-Item -Recurse .\node_modules\
npm i
# Runs into issue 2 from #9020 as npm is installed as npm.exe not npm.cmd
npm run build
# See that the npm shim is named npm.exe
where.exe npm |
Fixed first two issues of #9020. If an executable cannot be found it now looks like this:
I was a bit surprised that the logic to find the package manager executables was duplicated (
util/yarn.ts
andnode-modules-collector
). But since I'm not familiar with how electron-builder works internally I didn't try to refactor anything regarding this