Can I manually install yarn?

I have a project structure that includes a hugo base directory and a subdirectory with a react component that I build and include in the static files published with hugo. I use yarn to automate some of the files moving around as well as building the react project as you normally use yarn. This works great locally.

But I can’t get Netlify to install yarn during the build process.

None of the suggested options for getting yarn installed automatically have worked. I’ve tried:

  • adding NETLIFY_USE_YARN = 'true' in my configuration
  • adding a fake yarn.lock file in my actual base directory

My workaround right now is to set the base path to the react directory (then yarn is detected and installed!) but it involves a lot more cd commands in and out of directories than should be necessary.

Any other ideas for how I can force Netlify to install yarn when the base path is detected as a hugo project and not a react project?

Turns out neither of those tricks work UNLESS you have a package.json file, once I set up a fake package.json everything worked as expected.

1 Like

Ah yeah, that makes sense actually! Thanks for coming back so everyone can benefit from what you found!