Default nodeLinker is node_modules instead of pnp
See original GitHub issueWhen I create a new project with yarn berry, the default value of nodeLinker is node-modules as default. It should be pnp (source).
How can I reset the default value (equal to the initial setup of yarn) of nodeLinker to pnp?
Steps to reproduce
yarn init -yyarn set version berryyarn add @yarnpkg/sdks -Dnode_modules folder is createdyarn sdks
Results
Actual
Internal Error: This tool can only be used with projects using Yarn Plug'n'Play
at SdkCommand.execute (C:\test-node-linker\node_modules\@yarnpkg\sdks\lib\commands\SdkCommand.js:39:19)
at SdkCommand.validateAndExecute (C:\test-node-linker\node_modules\clipanion\lib\advanced\Command.js:64:37)
at Cli.run (C:\test-node-linker\node_modules\clipanion\lib\advanced\Cli.js:132:38)
at Cli.runExit (C:\test-node-linker\node_modules\clipanion\lib\advanced\Cli.js:149:39)
at Object.<anonymous> (C:\test-node-linker\node_modules\@yarnpkg\sdks\lib\cli.js:16:5)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
Expect
Usage Error: No integrations have been provided as arguments, and no preexisting integrations could be found. Make sure to run `yarn sdks <integrations>` first, or `yarn sdks base` if you only need the SDK files and prefer to manage your own environment settings. Run `yarn sdks -h` to see the list of supported integrations.
$ sdks [--cwd #0] [-v,--verbose] ...
Versions
yarn: 3.0.2 OS: Windows 10
Workaround
To change manually value of nodeLinker to pnp, I added in .yarnrc.yml:
nodeLinker: pnp
...
Then I run yarn command and I got:
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0031: │ One or more node_modules have been detected and will be removed. This operation may take some time.
➤ YN0000: └ Completed
➤ YN0000: Done with warnings
Now when I run yarn sdks command, I got log in expected results.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Plug'n'Play | Yarn - Package Manager
In this install mode (the default starting from Yarn 2.0), Yarn generates a single .pnp.cjs file instead of the usual node_modules folder containing...
Read more >get rid of node_modules with Yarn Plug'n'Play - Medium
When you enable PnP, instead of copying every needed file from the cache to the node_modules folder, here's what Yarn does:.
Read more >Yarn Plug'n'Play vs node_modules - Gap Intelligence
This feature allows us to run Node.js projects without using the node_modules folder, which normally establishes the project dependencies.
Read more >Node-Modules configuration options with pnpm
By default, pnpm v5 will create a semi-strict node_modules. ... The default configuration looks like this: ... node-linker=pnp symlink=false ...
Read more >yarn pnp fallback to default require - node.js - Stack Overflow
'node_modules', 'transport') ). I cannot find a way to say to yarn@3.0.1 to do the fallback to the filesystem. I read about the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@rtritto Check if
C:\Users\<User>\.yarnrc.ymlexists and if it setsnodeLinker.If no, then running
yarn config --whyinstead ofyarn configwill tell you the path of the config file that sets each config.After hours of debugging around the same issue I ended up here, which fixed it!
In my case the root cause of those files being generated in
\Users\<User>\.yarnrc.ymlwas from runningyarnsomewhere outside a project by mistake. Strange that it initializes a project at that level. And this in combination with adding a.yarnrc.ymlwith anodeLinkerthat overwrites the default is hard to catch if you’re unfamiliar with yarn berry.