Home
Support Forums

Issues deploying with Yarn and private GSAP registry

Hello there Netlify pals!

Cassie here from GreenSock.

The issue

Our users are having some issues deploying sites on Netlify that are using yarn and our private GSAP registry - which requires a token set as an environment variable through your UI.

There is no issue deploying when users are using npm. Only Yarn.

The site

I’ve managed to recreate the issue on this site:

site name: loving-wilson-ff4891

I have pushed up a yarn.lock file as per this article

if you deploy a site that includes a yarn.lock file in the base of the repository, we’ll use Yarn to install dependencies.

And followed the ENV var/Private module instructions given in this doc

The site works locally. But it won’t deploy. Is there something going on with the Netlify build container?

It would be wonderful to get this resolved.

I hope I’ve given you all that you need.

Look forward to hearing from you.

  • Cassie :sparkles:

relevant log below

5:46:08 PM: > Successfully installed Yarn 1.22.10! Please open another terminal where the `yarn` command will now be available.
5:46:08 PM: No yarn workspaces detected
5:46:08 PM: Started restoring cached node modules
5:46:08 PM: Finished restoring cached node modules
5:46:09 PM: Installing NPM modules using Yarn version 1.22.10
5:46:09 PM: yarn install v1.22.10
5:46:09 PM: warning package.json: No license field
5:46:09 PM: warning gsap-trial-bonus-plugins@1.0.0: No license field
5:46:09 PM: [1/4] Resolving packages...
5:46:10 PM: [2/4] Fetching packages...
5:46:13 PM: error An unexpected error occurred: "https://npm.greensock.com/@gsap%2fbusiness/-/business-3.8.0.tgz: Request failed \"403 Forbidden\"".
5:46:13 PM: info If you think this is a bug, please open a bug report with the information provided in "/opt/build/repo/yarn-error.log".
5:46:13 PM: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
5:46:24 PM: Error during Yarn install
5:46:24 PM: Build was terminated: Build script returned non-zero exit code: 1
5:46:24 PM: Creating deploy upload records
5:46:24 PM: Failing build: Failed to build site

Hi @cassieevans,

Does the same issue occur with npm?

Additionally, what happens if you store the credentials in .yarnrc instead of .npmc when using Yarn?

1 Like

Hi Hrishikesh,

No issues with npm at all.

We are recommending people use npm instead - but this doesn’t really seem like a solution :upside_down_face:

With a .yarnrc the build also fails.

I’m going through this:

but by giving it a short read, I’m not sure if the bug still exists, or was fixed or what’s the status exactly? Some say it works, some say it doesn’t.

Would you be able to go through that thread?

1 Like

I’m taking a look - I’ve also taken this to the yarn discord. Lets see!

Just adding again though that this works on my machine - just not on Netlify.

So I’m not really sure what more I can do from my end.

Have you tried this on a Ubuntu machine? Maybe it’s just happening on Linux-based devices?

Since npm works fine, I believe it would have to do something with Yarn’s implementation, and because it works locally, it could be happening only on a few systems.

I haven’t tried on an Ubuntu machine and I don’t have one easily available I’m afraid.

I really need to open an issue with the yarn team so they can fix it. Build stuff isn’t really my area of expertise so I’d appreciate any information about the issue and the setup of the Netlify build container.

I can’t replicate this issue outside of Netlify so it’s pretty difficult for me to play middle-man here. :disappointed:

If this was just a personal issue I would use npm - but I don’t think I can just tell our users ‘you can’t use yarn with netlify’ - that seems less than ideal.

Bumping again - could I please have any relevant information from your side to take to the yarn team. Thanks.

5:46:13 PM: info If you think this is a bug, please open a bug report with the information provided in "/opt/build/repo/yarn-error.log"

You might want to use a virtual machine or a Docker image.

These files are deleted after the build finishes, so those logs are not available. If you need them, you might have to use the build script to store the file to an external server before the build exits.

I could try testing it on my end, would it be possible for you to share the repo?

I’m very very front-of-the-front-end mate - sorry. Build stuff isn’t my area at all.

I just need to be able to take something to yarn to try and get this sorted because we keep getting netlify users in our forums asking us what the issue is :grimacing:

If you can test it on your end that would be wonderful.

I tried this repo: https://github.com/cassieevans/test-yarn-netlify, seems to be private?

Oh sorry hrishikesh - I only just realised you meant git repo and not netlfiy site. :upside_down_face:

I’ve made it public - that is the right one.

Yeah, but sadly that also has the private module you’re using and I’d need the token.

Is there a read-only token or something of that sort that I could get to try this locally? You could share one via PM if needed.

Thanks for the token @cassieevans, I tried this on my Macbook for now, but I got the Not Found error too.

These are the logs:

Arguments: 
  /Users/hrishikesh/.nvm/versions/node/v17.0.1/bin/node /Users/hrishikesh/Desktop/test-yarn-netlify/node_modules/.bin/yarn

PATH: 
  /Users/hrishikesh/Desktop/test-yarn-netlify/node_modules/.bin:/Users/hrishikesh/Desktop/node_modules/.bin:/Users/hrishikesh/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/Users/hrishikesh/.nvm/versions/node/v17.0.1/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/Users/hrishikesh/Desktop/test-yarn-netlify/node_modules/.bin:/Users/hrishikesh/.asdf/shims:/usr/local/Cellar/asdf/0.8.1_1/libexec/bin:/Users/hrishikesh/Netlify/google-cloud-sdk/bin:/Users/hrishikesh/.nvm/versions/node/v17.0.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Users/hrishikesh/Desktop/test-yarn-netlify/node_modules/.bin

Yarn version: 
  1.22.17

Node version: 
  17.0.1

Platform: 
  darwin x64

Trace: 
  Error: https://registry.yarnpkg.com/@gsap%2fbusiness: Not found
      at Request.params.callback [as _callback] (/Users/hrishikesh/Desktop/test-yarn-netlify/node_modules/yarn/lib/cli.js:67029:18)
      at Request.self.callback (/Users/hrishikesh/Desktop/test-yarn-netlify/node_modules/yarn/lib/cli.js:140883:22)
      at Request.emit (node:events:390:28)
      at Request.<anonymous> (/Users/hrishikesh/Desktop/test-yarn-netlify/node_modules/yarn/lib/cli.js:141855:10)
      at Request.emit (node:events:390:28)
      at IncomingMessage.<anonymous> (/Users/hrishikesh/Desktop/test-yarn-netlify/node_modules/yarn/lib/cli.js:141777:12)
      at Object.onceWrapper (node:events:509:28)
      at IncomingMessage.emit (node:events:402:35)
      at endReadableNT (node:internal/streams/readable:1340:12)
      at processTicksAndRejections (node:internal/process/task_queues:83:21)

npm manifest: 
  {
    "name": "gsap-trial-bonus-plugins",
    "version": "1.0.0",
    "description": "Try all GSAP bonus plugins for free on CodeSandbox.\n\nSimply add gsap-trial to your dependencies or fork this template.",
    "main": "index.html",
    "scripts": {
      "preinstall": "yarn config list",
      "start": "parcel index.html --open",
      "build": "parcel build index.html"
    },
    "dependencies": {
      "gsap": "npm:@gsap/business",
      "parcel-bundler": "^1.6.1"
    },
    "devDependencies": {
      "@babel/core": "7.2.0"
    },
    "resolutions": {
      "@babel/preset-env": "7.13.8"
    }
  }

yarn manifest: 
  No manifest

Lockfile: 
  No lockfile

Not sure if it helps you to get to the bottom of this issue.

We’re using different versions of node so maybe that’s a step in the right direction.

Thanks so much for your help pal. I’ll take this over to the yarn team now.

Hugely appreciated. Have a lovely day!

If that makes a difference, you could try setting the same Node Version on Netlify by using the NODE_VERSION environment variable.