Closed nicolo-ribaudo closed 5 months ago
I assumed that the problem is that jsr is running yarn add @nic-test/test-log@npm:@jsr/nic-test__test-log
instead of yarn add @nic-test/test-log@npm:@jsr/nic-test__test-log@^0.1.0
. So I tried manually running yarn add @nic-test/test-log@npm:@jsr/nic-test__test-log@^0.1.0
(yarn dlx jsr
already created the .npmrc
file), but Yarn is still trying to fetch from the default registry:
➜ yarn add @nic-test/test-log@npm:@jsr/nic-test__test-log@^0.1.0
➤ YN0000: · Yarn 4.1.0
➤ YN0000: ┌ Resolution step
➤ YN0035: │ @nic-test/test-log@npm:@jsr/nic-test__test-log@^0.1.0: Package not found
➤ YN0035: │ Response Code: 404 (Not Found)
➤ YN0035: │ Request Method: GET
➤ YN0035: │ Request URL: https://registry.yarnpkg.com/@jsr%2fnic-test__test-log
➤ YN0000: └ Completed in 0s 757ms
➤ YN0000: · Failed with errors in 0s 765ms
yarn add @nic-test/test-log@npm:@jsr/nic-test__test-log@^0.1.0
works if I create this .yarnrc.yml
file:
npmScopes:
jsr:
npmRegistryServer: "https://npm.jsr.io"
Maybe yarn dlx jsr
should create it automatically, rather than .npmrc
.
Additional context: this only applies when using >= Yarn 2 (berry), not when using Yarn 1 (classic). Yarn 2 does not read from .npmrc
.
@marvinhagemeister Probably we should detect the Yarn version that is in use for a given project, and if it's not Yarn 1, we create the .yarnrc.yml
.
Docs: https://yarnpkg.com/migration/guide
Also WHY YARN WHY? :(
I created an empty project with Yarn, following Yarn's docs in an empty folder:
Then, I run
yarn dlx jsr add @nic-test/test-log
(copy-pasted from the Yarn tab at https://jsr.io/@nic-test/test-log@0.1.0), and I get this output: