monorepo icon indicating copy to clipboard operation
monorepo copied to clipboard

[bug] yarn install fails on minimal repo after paraglide init

Open jldec opened this issue 2 years ago • 3 comments

Problem

yarn appears to have slightly different peer dependency resolution compared to npm or pnpm.

This results in a failure installing @inlang/paraglide-js in projects or environments (like codesandbox) where yarn is the default.

$ yarn
yarn install v1.22.19
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "@inlang/paraglide-js > @inlang/[email protected]" has unmet peer dependency "@sinclair/typebox@^0.31.17".
[4/4] 🔨  Building fresh packages...
success Saved lockfile.
$ paraglide-js compile --project ./project.inlang
[##################################################################################] 82/82node:internal/errors:490
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@sinclair/typebox' imported from /Users/jldec/inlang/yarn-paraglide/node_modules/@inlang/language-tag/dist/interface.js
    at new NodeError (node:internal/errors:399:5)
    at packageResolve (node:internal/modules/esm/resolve:889:9)
    at moduleResolve (node:internal/modules/esm/resolve:938:20)
    at defaultResolve (node:internal/modules/esm/resolve:1153:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
    at link (node:internal/modules/esm/module_job:76:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v18.15.0
error Command failed with exit code 1.

Expected behavior

paraglide-js should work in projects that use yarn.

Reproduction

Run the following in an empty directory:

yarn init -y
git init
npx @inlang/paraglide-js@latest init
yarn install

Other information

https://github.com/jldec/yarn-paraglide

jldec avatar Jan 09 '24 17:01 jldec

Great haha. This is an SDK issue (the position we are hiring)

samuelstroschein avatar Jan 09 '24 19:01 samuelstroschein

Just came here to say this. Saw the same thing. For now I guess I'll just manually add.

yarn version: 1.22.21

JoshuaHintze avatar Jan 25 '24 03:01 JoshuaHintze

We should probably drop support for yarn below v3.

  • sveltekit and other libs are dropping support
  • yarn <3 is broken because it deviates from node module resolution
CleanShot 2024-01-25 at 09 45 06@2x

samuelstroschein avatar Jan 25 '24 08:01 samuelstroschein