Jump to content
Search Community

@gsap/react install fails with 403 error

TimTh test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

Hello - 

 

I’m trying to install @gsap/react in a project deployed on netlify, but it’s failing in a couple different ways.

 

First, if I build a project without club plugins, i.e. npm install gsap, I can successfully install @gsap/react locally but then it fails in the netlify build:

 

npm ERR! 403 403 Forbidden - GET **https://npm.greensock.com/@gsap%2Freact/-/react-2.0.2.tgz** - You must be logged in to install/publish packages.

8:37:10 PM: npm ERR! 403 In most cases, you or one of your dependencies are requesting

8:37:10 PM: npm ERR! 403 a package version that is forbidden by your security policy, or

8:37:10 PM: npm ERR! 403 on a server you do not have access to.

8:37:10 PM: npm ERR! A complete log of this run can be found in: /opt/buildhome/.npm/_logs/2023-12-20T04_37_09_097Z-debug-0.log

 

Second, if I build a project with club plugins, i.e. npm install gsap/shockingly, then @gsap/react fails the local install with a similar error:

 

$ npm install @gsap/react

npm ERR! code E403

npm ERR! 403 403 Forbidden - GET https://npm.greensock.com/@gsap%2Freact - bad authorization header. Please login again npm ERR! 403 In most cases, you or one of your dependencies are requesting

npm ERR! 403 a package version that is forbidden by your security policy, or

npm ERR! 403 on a server you do not have access to.

 

Anyone have any suggestions?

 

Thank you!

Edited by TimTh
removed duplicate cut & paste error info
Link to comment
Share on other sites

  • Solution

Hi Tim,

 

I've been trying a some approaches to replicate this and found a few things in the process.

 

First be completely sure that your .npmrc file looks like this:

always-auth=true
//npm.greensock.com/:_authToken=${NPM_TOKEN}
@gsap:registry=https://npm.greensock.com

Be sure to add the dollar sign ($) before the curly braces and that your token is correct on the environmental variables in Netlify.

 

Second the installation error in your local machine is due to the fact that your .npmrc file looks like the one above. If you want to install the @gsap/react package after you modified the .npmrc file, you'll have to add your token in it (not the environmental variable), install the @gsap/react package and then modify your .npmrc file to have the variable instead of the token. Remember to never push this file to a public repo while it has the token in it.

Hopefully we'll find a way to simplify this for you and the rest of our users.

 

This repo is working as expected and deploying to Netlify without any issues:

https://github.com/rhernandog/usegsap-bonus-netlify

 

https://taupe-cocada-a61f34.netlify.app/

Just a Draggable logo with Intertia Plugin

 

Hopefully this helps.

Happy Tweening!

Link to comment
Share on other sites

Hi Rodrigo - I got it working with your steps, thank you very much! Turns out I had a type in my npmrc file when I first tried installing the react package my auth token. My bad, sorry to take your time with this. However, it was helpful to know that the @gsap/react does require the club token - I wasn't 100% clear on that. Maybe I missed it in the docs. I wonder if it would be helpful to highlight. Regardless, thanks again, really appreciate the super support as always.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...