TimTh Posted December 20, 2023 Share Posted December 20, 2023 (edited) 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 December 20, 2023 by TimTh removed duplicate cut & paste error info Link to comment Share on other sites More sharing options...
Solution Rodrigo Posted December 20, 2023 Solution Share Posted December 20, 2023 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 More sharing options...
TimTh Posted December 20, 2023 Author Share Posted December 20, 2023 Thanks Rodrigo. I did try installing @gsap/react with the actual auth token in my npmrc file before posting, but I will try again and dig into your repo to see if I missed anything else and let you know. I appreciate your help, as always. Link to comment Share on other sites More sharing options...
Rodrigo Posted December 20, 2023 Share Posted December 20, 2023 No problemo Tim! Keep us posted as you go! Happy Tweening! Link to comment Share on other sites More sharing options...
TimTh Posted December 21, 2023 Author Share Posted December 21, 2023 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. 1 Link to comment Share on other sites More sharing options...
Rodrigo Posted December 22, 2023 Share Posted December 22, 2023 16 hours ago, TimTh said: My bad, sorry to take your time with this. No problemo Tim, you're living testament that it happens to the best of us 😄 Let us know if you have other questions. Happy Tweening! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now