Home
Support Forums

How to get Netlify to use yarn if there is no yarn.lock file?

We have a monorepo with Lerna and Yarn spaces.
I have been trying to setup an ignore line following instructions like here

The thing is, as far as I understand, I need a netlify.toml file in each subfolder (= app / package) and make these “base directory”. Which leads to a new issue: there is no yarn.lock in these directories. So Netlify does not use Yarn and the build fails.

I also seem to have an issue with write permissions. “npm WARN checkPermissions Missing write access”

hi there!

does this help?

That seems to be exactly what we need.

But I am having an issue on how to enable it.

I have this config

[build]
  publish = "build"
  command = "yarn build"
  ignore = "git diff --quiet \"${CACHED_COMMIT_REF}\" \"${COMMIT_REF}\" . ../../yarn.lock ../bzx-common"
  environment = { CI = '', NETLIFY_USE_YARN = true }

But it seems that the syntax for environment does not work.

I got this error:

: json: cannot unmarshal bool into Go struct field BuildConfig.Config.build.environment of type string

Ok I set true as a string. It worked. Thanks.

I’ve been looking in the docs for a while, but sometimes some pieces are found in different places. I’d like to suggest something: an exhaustive table of all env vars available during the deploys.

For example I found CACHED_COMMIT_REF and COMMIT_REF in a post in this forum but never came across these in the docs. (they might be there just didn’t see them)

HI @AoDev ! Glad you got this working! There are definitely quite a few environment variables, and the list can get confusing, but i did find those two that you mentioned here:

bringing this up not to prove you wrong :wink: just to ask if there is a way that we could have highlighted this differently or made this information easier to find?

if you were looking somewhere else or have ideas on how we can make this list more navigable we would love to hear it!

1 Like

I guess I missed them because I didn’t really know what I had to find.

It’s more about the context. The path I had to follow to get to a solution got me to read tens of comments in 2 - 3 github issues in the netlify/build-image repo, then jumping to the docs that directly links to a particular section where env vars aren’t shown. Then I reached to the Netlify forums from a Google search, reading a couple of other users related questions…

It’s in one of these answers I got these variables Issues with build.ignore command not ignoring as required - #13 by luke

So, the info is there but the search path is not really straightforward like reading the entire documentation carefully. I don’t know what could be done to help find things more easily.

Anyway thanks again : ))

thank you @AoDev - that writeup was helpful! I will get some eyes on this.

Hey there, @AoDev

I wanted to follow up on what @perry shared here!

We have taken this feedback to the Documentation team. They are hard at work ensuring that our Docs are informative and well-structured. :slight_smile: While I cannot offer an ETA on your proposed changes, please know that we greatly appreciate the feedback and we encourage you to continue bringing thoughts and suggestions to the Forums!

1 Like

How I can build a website like Showbox on netlify platform. Any recommendations by the experts.

Hey there, @apksclub

Welcome to the Forums :netliconfetti: We try and keep threads to one topic at a time. It looks like your question isn’t quite related to yarn / yarn.lock documentation.

First, please start by reading through our Docs! Then, if you still have questions, please help us by creating a new thread with a fully formed question!