Skip to content

fix: use npx to run lex build command for windows compat#2917

Open
luo2430 wants to merge 1 commit into
npmx-dev:mainfrom
luo2430:main
Open

fix: use npx to run lex build command for windows compat#2917
luo2430 wants to merge 1 commit into
npmx-dev:mainfrom
luo2430:main

Conversation

@luo2430

@luo2430 luo2430 commented Jun 15, 2026

Copy link
Copy Markdown

🔗 Linked issue

none

🧭 Context

Resolved an issue during pnpm install on Windows

│ $ lex build --lexicons lexicons --out shared/types/lexicons --clear ◉ cache hit, replaying
│ ---
│ vp run: cache hit, 419ms saved.
│ $ node scripts/generate-file-tree-sprite.ts ◉ cache hit, replaying
│ ---
│ vp run: cache hit, 193ms saved.
│  ERROR  [unhandledRejection] Error while importing module C:/Users/24306/git_learning/npmx-dev/modules/security-headers.…
│ Require stack:
│ - C:\Users\24306\git_learning\npmx-dev\shared\utils\constants.ts
│     at loadNuxtModuleInstance (/C:/Users/24306/git_learning/npmx-dev/node_modules/.pnpm/@nuxt+kit@4.4.5_magicast@0.5.2/n…
│  ERROR  [unhandledRejection] Error while importing module C:/Users/24306/git_learning/npmx-dev/modules/standard-site-syn…
│ Require stack:
│ - C:\Users\24306\git_learning\npmx-dev\shared\utils\constants.ts
│     at loadNuxtModuleInstance (/C:/Users/24306/git_learning/npmx-dev/node_modules/.pnpm/@nuxt+kit@4.4.5_magicast@0.5.2/n…
│  ERROR  [unhandledRejection] Error while importing module C:/Users/24306/git_learning/npmx-dev/modules/blog.ts: Error: C…
│ Require stack:
│ - C:\Users\24306\git_learning\npmx-dev\shared\utils\constants.ts
│     at loadNuxtModuleInstance (/C:/Users/24306/git_learning/npmx-dev/node_modules/.pnpm/@nuxt+kit@4.4.5_magicast@0.5.2/n…
│  ERROR  Error while importing module C:/Users/24306/git_learning/npmx-dev/modules/blog.ts: Error: Cannot find module '..…
│ Require stack:
│ - C:\Users\24306\git_learning\npmx-dev\shared\utils\constants.ts
│     at loadNuxtModuleInstance (/C:/Users/24306/git_learning/npmx-dev/node_modules/.pnpm/@nuxt+kit@4.4.5_magicast@0.5.2/n…
└─ Failed in 3.3s at C:\Users\24306\git_learning\npmx-dev
[ELIFECYCLE] Command failed with exit code 1.
[ERROR] Command failed with exit code 1: "C:\Program Files\nodejs\node.exe" "C:\Users\24306\AppData\Local\pnpm\store\v11\links\@\pnpm\11.1.1\609303f0ed14bcc46c877b61a14f10e5fc0e12baa6026268fd68c5a6e134d86c\node_modules\pnpm\bin\pnpm.mjs" install

📚 Description

Just add npx in front of lex build --lexicons lexicons --out shared/types/lexicons --clear in vite.config.ts

@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Error Error Jun 15, 2026 12:42pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Jun 15, 2026 12:42pm
npmx-lunaria Ignored Ignored Jun 15, 2026 12:42pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c06b9ff0-cd0d-4854-9887-55d1dcf73fa3

📥 Commits

Reviewing files that changed from the base of the PR and between 57318ba and e953850.

📒 Files selected for processing (1)
  • vite.config.ts
✅ Files skipped from review due to trivial changes (1)
  • vite.config.ts

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • Chores
    • Updated build configuration to ensure the lexicon generation task uses the correct tool invocation method, improving build reliability and consistency.

Walkthrough

In vite.config.ts, the generate:lexicons task command is updated to invoke the lex CLI via npx lex build instead of lex build directly, with all other arguments (--lexicons lexicons, output path shared/types/lexicons, and --clear) remaining unchanged.

Changes

npx lex CLI invocation

Layer / File(s) Summary
generate:lexicons task command
vite.config.ts
The task command string for generate:lexicons is changed from lex build ... to npx lex build ..., altering how the lex binary is resolved at runtime whilst preserving all build arguments.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding npx to the lex build command for Windows compatibility.
Description check ✅ Passed The description is directly related to the changeset, providing context about the Windows compatibility issue and explaining why npx was added to the lex build command.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown

Hello! Thank you for opening your first PR to npmx, @luo2430! 🚀

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any issues you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Vercel

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@luo2430 luo2430 changed the title fix(vite): use npx to run lex build command for windows compat fix: use npx to run lex build command for windows compat Jun 15, 2026
@MatteoGabriele

Copy link
Copy Markdown
Member

@luo2430, thank you for your contribution.
Why do you think there's a need for npx? As far as I know, the lex binary is added by the @atproto/lex package.

@luo2430

luo2430 commented Jun 16, 2026

Copy link
Copy Markdown
Author

@MatteoGabriele Thank you for your reply. In simple terms, it is for maximum cross-platform compatibility. The current version of pnpm on Windows cannot run lex properly. I repeatedly cleaned and ran it several times, but it failed, and even pnpx didn't work. Later, I found that npx can be directly passed. As a non-runtime dependency, I think using npx is also acceptable. I can delete the lex in the devDependencies, and submit another commit.

@MatteoGabriele

Copy link
Copy Markdown
Member

Thank you @luo2430. I'm checking with someone on the team who has a Windows machine to check this issue, since I'm on a Mac

@43081j

43081j commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

it does work on my windows machine without npx but iirc using npx here is the better thing to do cross-platform anyway.

so even if it already works fine for some windows machines, this is probably a good change.

@luo2430

luo2430 commented Jun 16, 2026

Copy link
Copy Markdown
Author

@MatteoGabriele

I tried deleting lex from devDependencies, but it got an error. Maybe even if you use npx, it's better to keep lex. If you don't want to change this command, I can also write the solution in a place like the readme.

Progress: resolved 2300, reused 1850, downloaded 5, added 1, done
. postinstall$ (pnpm rebuild @resvg/resvg-js || true) && vp run generate:lexicons && vp run generate:sprite && nuxt prepar…
│ $ npx lex build --lexicons lexicons --out shared/types/lexicons --clear
│ npm error could not determine executable to run
│ npm error A complete log of this run can be found in: C:\Users\24306\npm-cache\_logs\2026-06-16T21_34_30_062Z-debug-0.log
└─ Failed in 12.4s at C:\Users\24306\git_learning\npmx-dev

@MatteoGabriele

Copy link
Copy Markdown
Member

@43081j I'm not a huge fan of using npx since it downloads the latest version without respecting versioning, and also skips the minimum release age check. Perhaps if we really want to go that route, we should use pnpm exec, which still has a default minimum release age of 1 day.

@ghostdevv

ghostdevv commented Jun 16, 2026

Copy link
Copy Markdown
Member

@43081j I'm not a huge fan of using npx since it downloads the latest version without respecting versioning, and also skips the minimum release age check. Perhaps if we really want to go that route, we should use pnpm exec, which still has a default minimum release age of 1 day.

+1 - if it's not working then it seems to be a bug in pnpm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants