-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Bug] yarn add node
fails on PnP
#637
Comments
@JLHwung In case it can help you, this is a previous comment from @arcanis on this topic:
|
Yep, it's a tricky one 🤔 It worked in npm / Yarn 1 because the shell only runs symlinks if the underlying file actually exists, whether in our case the bin initialisers are regular files. It's not super pretty, but I think I'll special-case this one; it seems very unlikely it'll ever show up in another package. |
This comment has been minimized.
This comment has been minimized.
This issue reproduces on master:
|
Looking at the
I guess the intent is to make the
Can I know what are exactly your requirements? The way Yarn is implemented, we already guarantee that the Node binary used by the scripts will be exactly the same one as the one used to run Yarn itself (it was already the case in the v1). Would using nvm or similar be ok for your use case? ¹ For example in Yarn 2 we write the build state into a file after all build scripts have executed. Due to how |
AFAIK, the use case of Update: I have found a way around this issue: In babel/babel#10873 I removed |
Hey y'all I am pretty clueless on how to resolve this currently - Can someone give me a hint? Getting this error on our project:
Is there some kind of work around? |
Hello, this is still an issue for me # This file contains the result of Yarn building a package (node@npm:20.13.1)
# Script name: preinstall
node:internal/modules/cjs/loader:1148
throw err;
^
Error: Cannot find module '/home/***/node_modules/node/bin/node'
at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
at Module._load (node:internal/modules/cjs/loader:986:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v20.13.1 $ yarn --version
3.8.2 |
I was seeing the same error in my project. |
Describe the bug
yarn add [email protected]
throwsMODULE_NOT_FOUND
on yarn v2To Reproduce
Environment if relevant (please complete the following information): Sherlock
Additional context
The preinstall scripts of
node@npm
will invoke the binarynode
and generates/bin/node.js
as its binary entry. It seems to me that Yarn incorrectly treatnode
inpreinstall
as a resolve request when this package providesnode
binary through thebin
field.It is now blocking babel's migration to yarn v2. I am willing to implement a fix if @arcanis can help me narrow down the issue.
The text was updated successfully, but these errors were encountered: