Problem with yarn.lock at build time

6:29:12 PM: > Successfully installed Yarn 1.3.2! Please open another terminal where the yarn command will now be available.

6:29:13 PM: Installing NPM modules using Yarn version 1.3.2

6:29:13 PM: yarn install v1.3.2

6:29:13 PM: error An unexpected error occurred: “Unknown token: { line: 3, col: 2, type: ‘INVALID’, value: undefined } 3:2 in /opt/build/repo/yarn.lock”.

I am just about at the end of my ability. Any help would be gratefully appreciated. Thank you.

hi there, what happens if you deploy the site without the yarn.lock file?

Hi Perry. Thank you for your suggestion. Removing the yarn-lock file let the deploy build much further, unfortunately failed at the very last hurdle (man i hate that). I think I have got this site so messed up with using yarn and npm (I really have no idea what I am doing). Anyways I managed to do a manual deploy successfully so panic averted for the time being. Again thank Perry for your help. PS. Sorry slow to respond, I am in the Australian time zone

no problem, this is a global forum - we’re not all in one timezone.

i bet we can get things working again with a little more troubleshooting. first thing i would suggest is to post the build log that you received with the errors here so we can evaluate what might be going wrong.

Hi Perry. Thank you for your persistence. I have taken a look at the deploy log and it seems now (just guessing) deploy is installing an older version of node.

11:32:37 AM: Starting build script
11:32:37 AM: Installing dependencies
11:32:38 AM: Downloading and installing node v8.17.0…
11:32:38 AM: Downloading
11:32:39 AM: Computing checksum with sha256sum
11:32:39 AM: Checksums matched!
11:32:41 AM: Now using node v8.17.0 (npm v6.13.4)

Then complains the node version is wrong!

Executing user command: gatsby build
11:34:14 AM: error Gatsby requires Node.js 10.13.0 or higher (you have v8.17.0).
11:34:14 AM: Upgrade Node to the latest stable release

How I get the netlify build to install 10.13.0 or higher?

On my machine I am runing node 12.16.2. Site is still building fine on my machine.

Cheers John

Hi @DeCosta,

You can change the Node.js version used in your builds by setting the NODE_VERSION environment variable or by adding a .nvmrc file. More information in the docs here.

Thank you @ehmicky. That solved the node.js version issue for me. I set environment variable. But i will add a .nvmrc file to my project file because this seems it would be better practice longterm. Cheers John
Update. I fixed a bug in my project code and BINGO the site is auto deployed. Thank you and @perry for enthusiastic support. I have learned quite a lot over the last few days. I LOVE NETLIFY.


fantastic @DeCosta. glad we could help. You are right, sometimes problems are great opportunities to learn how things really work! come back any time you need more help or some pointers!