fix(pm): Windows runtime fixes — PATH, execute, global dir, cache#2706
fix(pm): Windows runtime fixes — PATH, execute, global dir, cache#2706
Conversation
On Windows, node_modules/.bin/ contains Unix shim scripts that can't be executed directly. Prefer .cmd shim if available, otherwise use sh to execute the Unix shim. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
build_path_env hardcoded ":" as PATH separator, but Windows uses ";". This caused node_modules/.bin paths to not be found when executing npm scripts via cmd.exe on Windows. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Windows npm global packages are in <prefix>/node_modules, not <prefix>/lib/node_modules. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces several critical fixes to improve the package manager's compatibility and functionality on Windows. The changes address issues related to environment variable path handling, binary execution, and the location of global package installations, ensuring a more robust and native experience for Windows users. These adjustments are essential for the correct operation of the package manager across different operating systems. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces several fixes for running on Windows. The changes correctly adjust the PATH separator, the global package directory path, and the binary execution logic for Windows environments. The code is functionally correct. The provided suggestion to refactor a section of the code for better readability and maintainability by reducing code duplication has been retained as it aligns with general best practices and does not contradict any specific rules.
Replace scattered cfg!(windows) with top-level imports: - PATH_SEPARATOR: ";" on Windows, ":" on Unix - GLOBAL_NODE_MODULES: "node_modules" on Windows, "lib/node_modules" on Unix Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Hardlinks cannot cross drive boundaries on Windows. When cache is on C: but project is on D:, utoo falls back to copy (very slow). Detect cross-drive and use a cache dir on the project's drive instead (e.g. D:\.cache\nm). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2de6fdb to
9e0c88f
Compare
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use GLOBAL_NODE_MODULES constant instead of hardcoded 'lib/node_modules'. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1cd166f to
180e84f
Compare
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3a97f5d to
e1ca87b
Compare
Use cwd.ancestors().last() to get drive root instead of manual component extraction. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
184bdc1 to
84c7685
Compare
- Use top-level import for GLOBAL_NODE_MODULES in link.rs test - Add ant-design-x install + build test case to both Windows and Unix e2e Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
84c7685 to
581de21
Compare
Summary
Follow-up to #2702. Fixes utoo runtime issues on Windows:
Changes
PATH separator (
platform_const.rs,script.rs);instead of:on Windows —:conflicts with drive letters likeD:execute_binary (
execute.rs).cmdshim if exists, otherwise useshto execute Unix shim scriptscmd.args()per Gemini reviewGlobal package dir (
global_bin.rs)<prefix>/node_moduleson Windows instead of<prefix>/lib/node_modulesPlatform constants (
platform_const.rs)PATH_SEPARATORandGLOBAL_NODE_MODULESconstants to avoid scatteredcfg!(windows)Cross-drive cache (
user_config.rs)C:\.cache\nm) is on a different drive than project (e.g.D:\project)Verified
🤖 Generated with Claude Code