I can’t seem to figure out how to install Yarn globally in Toolbox.
Upon running npm install --global yarn
I get npm WARN checkPermissions Missing write access to /usr/local/lib followed by a bunch of access denied errors.
I tried to install Yarn locally but as a new developer I’m not sure whether that is a good practice or not. I also can’t figure out how to execute Yarn when installed locally.
Any solutions? Should I consider running a podman node image instead of Toolbox? I’m looking to run and develop and Express app.
Well, in toolbox, your user namespace is root, so that is okay for that particular case. Otherwise, you would need to install it with layering and livefs enabled AFAICT. So the container approach seems to be more sensible to me, especially on Silverblue and CoreOS and IoT. You won’t need a password either, though you still get the familiar warning about “great responsibility” etc…
Even better would be using a node manager like Volta which allows setting an exact node version and bypasses this problem completely by installing node as user. Search this forum for volta for more information.
A tip: Nvm is fine, but it’s slow due to being a weird bash script that just grew out of proportion. Setting it up and sourcing it is also stranger than it should be. If you care about speed, I’d go for fnm (which has a very similar feature set as Nvm, but written in Rust) or Volta, which has a slightly different feature set (not so concerned with checking installed version when you cd into a directory, but installing tools is easier.)