Switch to Yarn 3 to manage monorepo

As some of you may know, the repository will now be managed using Yarn 3. There are several reasons:

The main one is that Lerna is essentially deprecated and certain bugs that are becoming more and more of a problem as the repo grows in size will never be fixed. So we need to switch to either Npm Workspace or Yarn Workspace. I first tried with npm workspaces, but as often with npm it felt very messy, riddled with bugs, and tons of non-sensical warnings and errors. It's supposed to be production ready but it feels more like unusable pre-alpha software.

So I've tried with Yarn instead and that worked a lot better. Quite a few issues to fix too but they seem to have found ways to handle and present errors properly so that it was relatively easy to fix things and get it working. All apps can now be built with Yarn and all tools have been switched to yarn too.

We'll also get a few additional benefits:

  • No more package-lock files. Because npm randomly changes these files it always caused issues in pull requests. With yarn, there's just one yarn.lock at the root, which should cause less troubles.

  • Faster installation. We aren't taking advantage of their "zero-install" technique yet but even without this it's a lot faster to install the repo. Building the packages will probably be faster too since we now do it in parallel.

The changes are now in the repo, so if you notice any issue feel free to post here.

And to get things running on an existing repo, just pull the latest changes and run:

If you have Node >= 16, run corepack enable first. For Node < 16, run npm i -g corepack

npm run clean && yarn install

(We still need npm to run the clean command)

2 Likes

Is this dependent on the version of yarn installed? I wasn't successful in building joplin from a fresh clone.

~$ yarn --version
1.22.11

Output from me running it:

~/yarntest/joplin$ npm run clean && yarn install

> clean
> npm run clean --workspaces --if-present && node packages/tools/clean && yarn cache clean


> @joplin/app-mobile@0.8.9 clean
> node tools/clean.js

To clean the Android build, in some rare cases you might also need to clear the cache in ~/.android and ~/.gradle

> @joplin/server@2.6.14 clean
> rm -rf dist/

Delete: /home/user/yarntest/joplin/packages/app-cli/node_modules
Delete: /home/user/yarntest/joplin/packages/app-clipper/node_modules
Delete: /home/user/yarntest/joplin/packages/app-desktop/node_modules
Delete: /home/user/yarntest/joplin/packages/app-mobile/node_modules
Delete: /home/user/yarntest/joplin/packages/fork-htmlparser2/node_modules
Delete: /home/user/yarntest/joplin/packages/fork-sax/node_modules
Delete: /home/user/yarntest/joplin/packages/fork-uslug/node_modules
Delete: /home/user/yarntest/joplin/packages/generator-joplin/node_modules
Delete: /home/user/yarntest/joplin/packages/htmlpack/node_modules
Delete: /home/user/yarntest/joplin/packages/lib/node_modules
Delete: /home/user/yarntest/joplin/packages/plugin-repo-cli/node_modules
Delete: /home/user/yarntest/joplin/packages/plugins/node_modules
Delete: /home/user/yarntest/joplin/packages/renderer/node_modules
Delete: /home/user/yarntest/joplin/packages/server/node_modules
Delete: /home/user/yarntest/joplin/packages/tools/node_modules
Delete: /home/user/yarntest/joplin/packages/turndown/node_modules
Delete: /home/user/yarntest/joplin/packages/turndown-plugin-gfm/node_modules
Delete: /home/user/yarntest/joplin/node_modules
➤ YN0000: Done in 0s 1ms
➤ YN0000: ┌ Resolution step
➤ YN0002: │ @aws-sdk/client-s3@npm:3.44.0 doesn't provide @aws-sdk/signature-v4-crt (p6155d), requested by @aws-sdk/middleware-sdk-s3
➤ YN0002: │ @aws-sdk/s3-request-presigner@npm:3.44.0 doesn't provide @aws-sdk/signature-v4-crt (pf5946), requested by @aws-sdk/middleware-sdk-s3
➤ YN0060: │ @joplin/app-desktop@workspace:packages/app-desktop provides react (p420ff) with version 16.13.1, which doesn't satisfy what react-test-renderer requests
➤ YN0060: │ @joplin/app-desktop@workspace:packages/app-desktop provides react-dom (p2e5b2) with version 16.9.0, which doesn't satisfy what re-resizable requests
➤ YN0002: │ @joplin/app-desktop@workspace:packages/app-desktop doesn't provide react-is (p0cdf0), requested by styled-components
➤ YN0060: │ @joplin/app-mobile@workspace:packages/app-mobile provides react (pb7acb) with version 17.0.2, which doesn't satisfy what react-redux requests
➤ YN0060: │ @joplin/app-mobile@workspace:packages/app-mobile provides react-native (pbf89e) with version 0.66.1, which doesn't satisfy what react-native-webview requests
➤ YN0002: │ @joplin/app-mobile@workspace:packages/app-mobile doesn't provide react-native-windows (pb66a5), requested by react-native-fs
➤ YN0002: │ @joplin/app-mobile@workspace:packages/app-mobile doesn't provide tslib (p1cc78), requested by @rollup/plugin-typescript
➤ YN0060: │ @joplin/fork-htmlparser2@workspace:packages/fork-htmlparser2 provides eslint (p4ecde) with version 6.8.0, which doesn't satisfy what @typescript-eslint/eslint-plugin and some of its descendants request
➤ YN0060: │ @joplin/fork-htmlparser2@workspace:packages/fork-htmlparser2 provides eslint (p83f76) with version 6.8.0, which doesn't satisfy what @typescript-eslint/parser requests
➤ YN0060: │ @joplin/fork-htmlparser2@workspace:packages/fork-htmlparser2 provides jest (pa940f) with version 26.6.3, which doesn't satisfy what ts-jest requests
➤ YN0060: │ @joplin/server@workspace:packages/server provides sqlite3 (p9ac44) with version 4.2.0, which doesn't satisfy what @rmp135/sql-ts and some of its descendants request
➤ YN0060: │ @joplin/server@workspace:packages/server provides sqlite3 (p05a2d) with version 4.2.0, which doesn't satisfy what knex requests
➤ YN0002: │ @octokit/rest@npm:16.43.2 doesn't provide @octokit/core (p84523), requested by @octokit/plugin-request-log
➤ YN0002: │ react-native-codegen@npm:0.0.7 doesn't provide @babel/preset-env (pe4ee6), requested by jscodeshift
➤ YN0060: │ root@workspace:. provides eslint (p2edfe) with version 7.32.0, which doesn't satisfy what eslint-plugin-react-hooks requests
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 0s 333ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ yeoman-generator@npm:2.0.5 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yeoman-generator@npm:4.13.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ ylru@npm:1.2.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yosay@npm:2.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ zxcvbn@npm:4.4.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 35s 749ms
➤ YN0000: ┌ Link step
➤ YN0076: │ fsevents@patch:fsevents@npm%3A1.2.13#~builtin<compat/fsevents>::version=1.2.13&hash=18f3a7 The linux-x64 architecture is incompatible with this module, link skipped.
➤ YN0076: │ fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=18f3a7 The linux-x64 architecture is incompatible with this module, link skipped.
➤ YN0076: │ 7zip-bin-mac@npm:1.0.1 The linux-x64 architecture is incompatible with this module, link skipped.
➤ YN0076: │ 7zip-bin-win@npm:2.2.0 The linux-x64 architecture is incompatible with this module, link skipped.
➤ YN0076: │ dmg-license@npm:1.0.10 The linux-x64 architecture is incompatible with this module, link skipped.
➤ YN0076: │ iconv-corefoundation@npm:1.1.7 The linux-x64 architecture is incompatible with this module, link skipped.
➤ YN0007: │ @joplin/app-clipper@workspace:packages/app-clipper must be built because it never has been before or the last one failed
➤ YN0007: │ husky@npm:3.1.0 must be built because it never has been before or the last one failed
➤ YN0007: │ nodemon@npm:2.0.15 must be built because it never has been before or the last one failed
➤ YN0007: │ keytar@npm:7.7.0 must be built because it never has been before or the last one failed
➤ YN0007: │ sharp@npm:0.26.3 must be built because it never has been before or the last one failed
➤ YN0007: │ sqlite3@npm:5.0.2 [ea905] must be built because it never has been before or the last one failed
➤ YN0007: │ core-js@npm:2.6.12 must be built because it never has been before or the last one failed
➤ YN0007: │ sharp@npm:0.25.4 must be built because it never has been before or the last one failed
➤ YN0007: │ @fortawesome/fontawesome-free@npm:5.15.4 must be built because it never has been before or the last one failed
➤ YN0007: │ electron@npm:14.1.0 must be built because it never has been before or the last one failed
➤ YN0007: │ lzma-native@npm:8.0.1 must be built because it never has been before or the last one failed
➤ YN0007: │ @fortawesome/fontawesome-common-types@npm:0.2.36 must be built because it never has been before or the last one failed
➤ YN0007: │ ejs@npm:2.7.4 must be built because it never has been before or the last one failed
➤ YN0007: │ sqlite3@npm:4.2.0 must be built because it never has been before or the last one failed
➤ YN0007: │ root@workspace:. must be built because it never has been before or the last one failed
➤ YN0007: │ @joplin/app-desktop@workspace:packages/app-desktop must be built because it never has been before or the last one failed
➤ YN0007: │ @joplin/app-mobile@workspace:packages/app-mobile must be built because it never has been before or the last one failed
➤ YN0007: │ @fortawesome/fontawesome-svg-core@npm:1.2.36 must be built because it never has been before or the last one failed
➤ YN0007: │ @fortawesome/free-regular-svg-icons@npm:5.15.4 must be built because it never has been before or the last one failed
➤ YN0007: │ @fortawesome/free-solid-svg-icons@npm:5.15.4 must be built because it never has been before or the last one failed
➤ YN0009: │ @joplin/app-desktop@workspace:packages/app-desktop couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-3933e171/build.log)
➤ YN0009: │ root@workspace:. couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-c8859fc9/build.log)
➤ YN0000: └ Completed in 1m 33s
➤ YN0000: Failed with errors in 2m 10s

Details of build.log

# This file contains the result of Yarn building a package (@joplin/app-desktop@workspace:packages/app-desktop)
# Script name: postinstall

[15:57:05] Using gulpfile ~/JoplinDev/yarntest/joplin/packages/app-desktop/gulpfile.js
[15:57:05] Starting 'build'...
[15:57:05] Starting 'compileScripts'...
[15:57:05] Starting 'compilePackageInfo'...
[15:57:05] Starting 'copyPluginAssets'...
[15:57:05] Starting 'copyApplicationAssets'...
[15:57:05] Starting 'updateIgnoredTypeScriptBuild'...
[15:57:05] Starting 'buildCommandIndex'...
[15:57:05] Starting 'compileSass'...
Compiling /home/user/yarntest/joplin/packages/app-desktop/tools/../gui/ExtensionBadge.jsx...
Compiling /home/user/yarntest/joplin/packages/app-desktop/tools/../gui/HelpButton.jsx...
Compiling /home/user/yarntest/joplin/packages/app-desktop/tools/../gui/IconButton.jsx...
Compiling /home/user/yarntest/joplin/packages/app-desktop/tools/../gui/ImportScreen.jsx...
Compiling /home/user/yarntest/joplin/packages/app-desktop/tools/../gui/ItemList.jsx...
Compiling /home/user/yarntest/joplin/packages/app-desktop/tools/../gui/Navigator.jsx...
Compiling /home/user/yarntest/joplin/packages/app-desktop/tools/../gui/NotePropertiesDialog.jsx...
Compiling /home/user/yarntest/joplin/packages/app-desktop/tools/../gui/NoteRevisionViewer.jsx...
Compiling /home/user/yarntest/joplin/packages/app-desktop/tools/../gui/NoteSearchBar.jsx...
Compiling /home/user/yarntest/joplin/packages/app-desktop/tools/../gui/NoteStatusBar.jsx...
Compiling /home/user/yarntest/joplin/packages/app-desktop/tools/../gui/PromptDialog.jsx...
Compiling /home/user/yarntest/joplin/packages/app-desktop/tools/../gui/TagItem.jsx...
Compiling /home/user/yarntest/joplin/packages/app-desktop/tools/../gui/ToolbarSpace.jsx...
Compiling /home/user/yarntest/joplin/packages/app-desktop/tools/../gui/VerticalResizer.jsx...
Copying to /home/user/yarntest/joplin/packages/app-desktop/tools/../gui/note-viewer/pluginAssets
Copying /home/user/yarntest/joplin/packages/app-desktop/node_modules/tinymce => /home/user/yarntest/joplin/packages/app-desktop/build/lib/tinymce
Generating /home/user/yarntest/joplin/packages/app-desktop/commands/index.ts...
[15:57:24] Finished 'compileScripts' after 18 s
Generated /home/user/yarntest/joplin/packages/app-desktop/packageInfo.js
[15:57:24] Finished 'compilePackageInfo' after 19 s
Generated /home/user/yarntest/joplin/packages/app-desktop/style.min.css
[15:57:24] Finished 'compileSass' after 19 s
[15:57:24] Finished 'updateIgnoredTypeScriptBuild' after 19 s
Generating /home/user/yarntest/joplin/packages/app-desktop/gui/MainScreen/commands/index.ts...
[15:57:24] 'copyPluginAssets' errored after 19 s
[15:57:24] Error: Code: 23: Command failed: rsync -a --delete  "/home/user/yarntest/joplin/packages/app-desktop/tools/../../../packages/renderer/assets/" "/home/user/yarntest/joplin/packages/app-desktop/tools/../gui/note-viewer/pluginAssets/"
rsync: stat "/home/user/yarntest/joplin/packages/app-desktop/gui/note-viewer/pluginAssets/katex/.katex.css.6l407q" failed: No such file or directory (2)
rsync: rename "/home/user/yarntest/joplin/packages/app-desktop/gui/note-viewer/pluginAssets/katex/.katex.css.6l407q" -> "katex/katex.css": No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1207) [sender=3.1.3]
: 
    at /home/user/yarntest/joplin/packages/tools/gulp/utils.js:43:23
    at ChildProcess.exithandler (node:child_process:404:5)
    at ChildProcess.emit (node:events:394:28)
    at ChildProcess.emit (node:domain:537:15)
    at maybeClose (node:internal/child_process:1064:16)
    at Socket.<anonymous> (node:internal/child_process:450:11)
    at Socket.emit (node:events:394:28)
    at Socket.emit (node:domain:537:15)
    at Pipe.<anonymous> (node:net:672:12)
    at Pipe.callbackTrampoline (node:internal/async_hooks:130:17)
[15:57:24] 'build' errored after 19 s

And trying to run it (just for fun)

~/yarntest/joplin/packages/app-desktop$ yarn start
[16:04:31] Using gulpfile ~/yarntest/joplin/packages/app-desktop/gulpfile.js
[16:04:31] Starting 'build'...
[16:04:31] Starting 'compileScripts'...
[16:04:31] Starting 'compilePackageInfo'...
[16:04:31] Starting 'copyPluginAssets'...
[16:04:31] Starting 'copyApplicationAssets'...
[16:04:31] Starting 'updateIgnoredTypeScriptBuild'...
[16:04:31] Starting 'buildCommandIndex'...
[16:04:31] Starting 'compileSass'...
Copying to /home/user/yarntest/joplin/packages/app-desktop/tools/../gui/note-viewer/pluginAssets
Copying /home/user/yarntest/joplin/packages/app-desktop/node_modules/tinymce => /home/user/yarntest/joplin/packages/app-desktop/build/lib/tinymce
Generating /home/user/yarntest/joplin/packages/app-desktop/commands/index.ts...
[16:04:31] Finished 'compileScripts' after 231 ms
Generated /home/user/yarntest/joplin/packages/app-desktop/packageInfo.js
[16:04:31] Finished 'compilePackageInfo' after 293 ms
Generated /home/user/yarntest/joplin/packages/app-desktop/style.min.css
[16:04:31] Finished 'compileSass' after 294 ms
[16:04:31] Finished 'updateIgnoredTypeScriptBuild' after 299 ms
Copying to /home/user/yarntest/joplin/packages/app-desktop/tools/../pluginAssets
Generating /home/user/yarntest/joplin/packages/app-desktop/gui/MainScreen/commands/index.ts...
Copying /home/user/yarntest/joplin/packages/app-desktop/node_modules/@fortawesome/fontawesome-free/webfonts => /home/user/yarntest/joplin/packages/app-desktop/build/lib/@fortawesome/fontawesome-free/webfonts
[16:04:31] Finished 'copyPluginAssets' after 310 ms
Generating /home/user/yarntest/joplin/packages/app-desktop/gui/NoteEditor/commands/index.ts...
Generating /home/user/yarntest/joplin/packages/app-desktop/gui/NoteList/commands/index.ts...
Generating /home/user/yarntest/joplin/packages/app-desktop/gui/NoteListControls/commands/index.ts...
Generating /home/user/yarntest/joplin/packages/app-desktop/gui/Sidebar/commands/index.ts...
Generating /home/user/yarntest/joplin/packages/lib/commands/index.ts...
[16:04:31] Finished 'buildCommandIndex' after 319 ms
Copying /home/user/yarntest/joplin/packages/app-desktop/node_modules/roboto-fontface/fonts => /home/user/yarntest/joplin/packages/app-desktop/build/lib/roboto-fontface/fonts
Copying /home/user/yarntest/joplin/packages/app-desktop/node_modules/codemirror/theme => /home/user/yarntest/joplin/packages/app-desktop/build/lib/codemirror/theme
Copying /home/user/yarntest/joplin/Assets/TinyMCE/langs => /home/user/yarntest/joplin/packages/app-desktop/build/lib/tinymce/langs
Copying /home/user/yarntest/joplin/packages/app-desktop/node_modules/@fortawesome/fontawesome-free/css/all.min.css => /home/user/yarntest/joplin/packages/app-desktop/build/lib/@fortawesome/fontawesome-free/css/all.min.css
Copying /home/user/yarntest/joplin/packages/app-desktop/node_modules/react-datetime/css/react-datetime.css => /home/user/yarntest/joplin/packages/app-desktop/build/lib/react-datetime/css/react-datetime.css
Copying /home/user/yarntest/joplin/packages/app-desktop/node_modules/smalltalk/css/smalltalk.css => /home/user/yarntest/joplin/packages/app-desktop/build/lib/smalltalk/css/smalltalk.css
Copying /home/user/yarntest/joplin/packages/app-desktop/node_modules/roboto-fontface/css/roboto/roboto-fontface.css => /home/user/yarntest/joplin/packages/app-desktop/build/lib/roboto-fontface/css/roboto/roboto-fontface.css
Copying /home/user/yarntest/joplin/packages/app-desktop/node_modules/codemirror/lib/codemirror.css => /home/user/yarntest/joplin/packages/app-desktop/build/lib/codemirror/lib/codemirror.css
Copying /home/user/yarntest/joplin/packages/app-desktop/node_modules/codemirror/addon/dialog/dialog.css => /home/user/yarntest/joplin/packages/app-desktop/build/lib/codemirror/addon/dialog/dialog.css
Copying /home/user/yarntest/joplin/packages/app-desktop/node_modules/@joeattardi/emoji-button/dist/index.js => /home/user/yarntest/joplin/packages/app-desktop/build/lib/@joeattardi/emoji-button/dist/index.js
Copying /home/user/yarntest/joplin/packages/app-desktop/node_modules/mark.js/dist/mark.min.js => /home/user/yarntest/joplin/packages/app-desktop/build/lib/mark.js/dist/mark.min.js
Copying /home/user/yarntest/joplin/packages/lib/services/plugins/sandboxProxy.js => /home/user/yarntest/joplin/packages/app-desktop/build/lib/@joplin/lib/services/plugins/sandboxProxy.js
[16:04:31] Finished 'copyApplicationAssets' after 416 ms
[16:04:31] Finished 'build' after 417 ms
App threw an error during load
Error: Cannot find module './ElectronAppWrapper'
Require stack:
- /home/user/yarntest/joplin/packages/app-desktop/main.js
- /home/user/yarntest/joplin/packages/app-desktop/node_modules/electron/dist/resources/default_app.asar/main.js
- 
    at Module._resolveFilename (internal/modules/cjs/loader.js:892:15)
    at Function.n._resolveFilename (electron/js2c/browser_init.js:245:1128)
    at Module._load (internal/modules/cjs/loader.js:737:27)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
    at Module.require (internal/modules/cjs/loader.js:964:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/home/user/yarntest/joplin/packages/app-desktop/main.js:5:28)
    at Module._compile (internal/modules/cjs/loader.js:1083:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1113:10)
    at Module.load (internal/modules/cjs/loader.js:940:32)
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Cannot find module './ElectronAppWrapper'
Require stack:
- /home/user/yarntest/joplin/packages/app-desktop/main.js
- /home/user/yarntest/joplin/packages/app-desktop/node_modules/electron/dist/resources/default_app.asar/main.js
- 
    at Module._resolveFilename (internal/modules/cjs/loader.js:892:15)
    at Function.n._resolveFilename (electron/js2c/browser_init.js:245:1128)
    at Module._load (internal/modules/cjs/loader.js:737:27)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
    at Module.require (internal/modules/cjs/loader.js:964:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/home/user/yarntest/joplin/packages/app-desktop/main.js:5:28)
    at Module._compile (internal/modules/cjs/loader.js:1083:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1113:10)
    at Module.load (internal/modules/cjs/loader.js:940:32)
mesa: for the --simplifycfg-sink-common option: may only occur zero or one times!
mesa: for the --global-isel-abort option: may only occur zero or one times!
mesa: for the --amdgpu-atomic-optimizations option: may only occur zero or one times!
[73924:1220/160431.920667:ERROR:sandbox_linux.cc(374)] InitializeSandbox() called with multiple threads in process gpu-process.

The last lines in that build log before it exploded seems to reference our old friend "pluginAssets"...

Does this directory actually exist? /home/user/yarntest/joplin/packages/app-desktop/gui/note-viewer/pluginAssets/katex/ I wonder if maybe it's not being created as it should.

It looks like it exists

~/yarntest/joplin/packages/app-desktop/gui/note-viewer$ ls -R
.:
index.html  lib.js  pluginAssets  preload.js  scrollmap.js

./pluginAssets:
highlight.js  katex  mermaid

./pluginAssets/highlight.js:
atom-one-dark-reasonable.css  atom-one-light.css

./pluginAssets/katex:
fonts  katex.css

./pluginAssets/katex/fonts:
KaTeX_AMS-Regular.woff2          KaTeX_Math-Italic.woff2
KaTeX_Caligraphic-Bold.woff2     KaTeX_SansSerif-Bold.woff2
KaTeX_Caligraphic-Regular.woff2  KaTeX_SansSerif-Italic.woff2
KaTeX_Fraktur-Bold.woff2         KaTeX_SansSerif-Regular.woff2
KaTeX_Fraktur-Regular.woff2      KaTeX_Script-Regular.woff2
KaTeX_Main-BoldItalic.woff2      KaTeX_Size1-Regular.woff2
KaTeX_Main-Bold.woff2            KaTeX_Size2-Regular.woff2
KaTeX_Main-Italic.woff2          KaTeX_Size3-Regular.woff2
KaTeX_Main-Regular.woff2         KaTeX_Size4-Regular.woff2
KaTeX_Math-BoldItalic.woff2      KaTeX_Typewriter-Regular.woff2

./pluginAssets/mermaid:
mermaid.min.js  mermaid_render.js

And does it work if you run the command manually?

rsync -a --delete  "/home/user/yarntest/joplin/packages/app-desktop/tools/../../../packages/renderer/assets/" "/home/user/yarntest/joplin/packages/app-desktop/tools/../gui/note-viewer/pluginAssets/"

Maybe it just didn't work that one time and if you run it again it will work.

1 Like

Just running the previous commands worked and yarn start brought Joplin up.
I'll try again from a fresh clone to see if it is any different

Worked first time... I have no idea then, carry on!

What is the suggested node version? e.g. I'm still using v14.15.0, which does not include corepack thus yarn.

Shall I use 16.13.1 or 17.3.0? What are your experiences? I am on macOS.

Right, I should have added that somewhere - if you don't have Node 16, you need to manually install corepack - npm i -g corepack

I strongly recommend using pnpm. It is very fast and does not have many problems encountered by yarn2/3 in practice. Please refer to

Give a few examples

  • yarn2 must run yarn install before running any commands, which is why you need to use npm run clean
  • yarn pack is inconsistent with the package printed by npm
  • In large-scale production projects (50+ modules), its performance is almost unacceptable (of course this is after comparison with pnpm)
  • The pnp mode officially recommended by yarn2 is almost unavailable in production, which requires the entire ecosystem to be compatible with it, which is almost impossible (the current esm only also causes very similar nausea problems)
  • yarn2 officials are always stubborn (the inconsistency above is considered to be a bug fix, but npm packaging does require this behavior)

It'd be too late to switch again to pnpm, but we could consider it if yarn doesn't quite work.

I think Yarn's pnp idea is great but it's indeed not quite usable yet, especially for us since neither Electron nor React Native support it. But I'm hoping some progress will be made with this, and that we'll be able to make use of it for at least certain parts of the monorepo (such as /lib).

Well, then maybe you will want a build cache plugin to avoid repeated builds. I have written a yarn2 plugin for production before, maybe you will be interested

This problem is not solved by pnpm official, but nx.js/rush.js does solve it (both can be used in coordination with pnpm), but they are indeed too complex tools, which may be difficult to use correctly.