Can't install with yarn

405 Views Asked by At

Why I cannot install packages with the modern yarn?

  • Windows 10
  • Node.js LTS 18.16.0
  • Yarn v2.x or v3.x

(it works with the old deprecated version v1.22.19)

I installed node and yarn the recommended way (LINK). I tried on a fresh virtual machine too.

Setting up a new repo gives some strange log messages:

C:\source\app1>yarn init
{
  name: 'app1',
  packageManager: '[email protected]'
}

C:\source\app1>yarn add lodash
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0013: │ lodash@npm:4.17.21 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed
➤ YN0000: Done in 0s 172ms

and yarn is not setting up the node_packages directory

C:\source\app1>dir /B
.editorconfig
.gitattributes
.gitignore
.pnp.cjs
.yarn
package.json
README.md
yarn.lock

it only downloads to the .yarn/cache directory

C:\source\app1>dir /B .yarn\cache
.gitignore
lodash-npm-4.17.21-6382451519-eb835a2e51.zip
0

There are 0 best solutions below