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
symlink for bin files when node-linker=hoisted
#4782
Comments
I am not against such setting, but it would not work on Windows. Even npm uses command shims on Windows because executable symlinks are not allowed on Windows. |
The "App Center CLI" I mentioned, treats Windows differently because of that. So if npm uses shims on Windows, pnpm could do the same. I know what I'm asking for is very specific. But the goal here is to increase compatibility with npm. Which would benefit people (including me) porting their projects (like React Native ones) from npm/yarn to pnpm. Although this whole issue isn't a blocker for me and the performance gain is much greater than the burden of manually changing a file every once in a while. |
A new setting supported: `prefer-symlinked-executables` When `true`, on Posix systems pnpm will create symlinks to executables in `node_modules/.bin` instead of command shims. This setting is `true` by default when `node-linker` is set to `hoisted`. close #4782
A new setting supported: `prefer-symlinked-executables` When `true`, on Posix systems pnpm will create symlinks to executables in `node_modules/.bin` instead of command shims. This setting is `true` by default when `node-linker` is set to `hoisted`. close #4782
Describe the user story
When using CodePush for React Native, the App Center CLI issues the following command to publish a new release:
This command assumes the bin file is a JS file and can be executed with node. This is true when using npm or classic yarn. But with pnpm (as you have described in the limitations section of the docs), binstubs are shell files. So the following error happens:
Providing an option to use symlinks instead of shell files for binstubs would solve this problem.
Describe the solution you'd like
Two solutions are possible:
node-linker=hoisted
in the.npmrc
file, pnpm can automatically use symlinks instead of shell scripts to match more closely with npm and classic yarn behavior..npmrc
to opt-in for this feature.Describe the drawbacks of your solution
Solution 1:
node-linker=hoisted
might rely on the binstubs being shell files.Solution 2:
node-linker
is not set tohoisted
, this setting could break bin files and scripts sinceNODE_PATH
is not being set. (This could be solved by showing a warning/error to users)Describe alternatives you've considered
I've worked around the issue described in the user story section by manually modifying the
.bin/react-native
file. But this change is temporary and will be overridden by pnpm.The text was updated successfully, but these errors were encountered: