Yarn Workspaces and Installing Mono Repo Packages

Hello. :slight_smile:

I am having issues building my new website which is a sub-directory within a Yarn workspace. Here’s a bit about my setup.

Much like described in the docs, I have a Yarn monorepo which contains 2 packages:

  1. JavaScript library
  2. Documentation site which has that library as a dependency

I have attached my build logs and settings below.

What looks to be happening, is my build command is being run, but the local JS library is not being installed from NPM but through the workspace. So I am getting an error in the build logs that the package cannot be found.

While this installs and runs locally correctly, something happens in the build step that prevents the local JS library from being installed correctly. Maybe it’s something else though?

Site Name:

Build Logs

Build Settings

Base directory: packages/docs
Build command: yarn build
Publish directory: packages/docs/_site

Additionally, in my Environment Variables I have:


In the package.json file of the documentation website sub directory, I have the library installed with its version number, to try to get it to install from NPM and not the workspace.

 "dependencies": {
     "horologist": "^1.1.1"

And help getting over this hump would be terrific. Thank you!

The horologist library when yarn is installing the npm packages is resolving it to the workspace package:


Hence, the dist folder is missing, so cannot resolve the distributed package path. That’s why you are getting the error. You can reproduce by cloning into a new directory on your local machine and running the build command exactly like Netlify does.

You would have to build the horologist package first to remove this error.


That was it. Thank you :slight_smile:

1 Like