Share Posted May 14, 2021 Hi ! I put this line : registry=https://npm.greensock.com in the .npmrc file and it worked ! But Cassie said it could fail because of the other packages... so I deleted it and now each time I push on Github it's still working. Have you tried it ? Link to comment Share on other sites More sharing options...
Author Share Posted May 14, 2021 So you went from: -------------------------- always-auth=true @gsap:registry=https://npm.greensock.com/ //npm.greensock.com/:_authToken=${NPM_TOKEN} -------------------------- to: -------------------------- always-auth=true registry=https://npm.greensock.com //npm.greensock.com/:_authToken=${NPM_TOKEN} -------------------------- Am I correct? No I haven't tried it yet, gonna do it asap 😃 Link to comment Share on other sites More sharing options...
Solution Author Solution Share Posted May 14, 2021 Solution: 1: Create .npmrc file in root of your project. 2: write following in the .npmrc file: -------------------------- always-auth=true registry=https://npm.greensock.com //npm.greensock.com/:_authToken=${NPM_TOKEN} -------------------------- 3: Go to Netlify and create an enviroment variable called : NPM_TOKEN 4: Push it up to your git repo and enjoy Shout out to Cassie, Prasanna and Sybilrondeau. ❤️ 4 1 Link to comment Share on other sites More sharing options...
Share Posted May 14, 2021 I did nothing, @Cassie did ! But be aware, as she said, it can also break the installation as it will be ok for gsap but not the other packages, so it's not so much a good solution for everybody. 1 Link to comment Share on other sites More sharing options...
Share Posted May 14, 2021 @Gr0x - looking at the .npmrc file content that you provided, it should throw errors in while running $npm install your local environment (unless you specify env vars). But it should be working fine in netlify. 1 Link to comment Share on other sites More sharing options...
Share Posted January 27 I can confirm that actually just making your .npmrc file always-auth=true registry=https://npm.greensock.com //npm.greensock.com/:_authToken=FAKE-FAKE-FAKE-FAKE And committing it, works too, without needing to set NPM_TOKEN environment variable Link to comment Share on other sites More sharing options...
Share Posted January 27 1 hour ago, thirsty said: I can confirm that actually just making your .npmrc file always-auth=true registry=https://npm.greensock.com //npm.greensock.com/:_authToken=FAKE-FAKE-FAKE-FAKE And committing it, works too, without needing to set NPM_TOKEN environment variable Yes it does, but as a practice it is recommended no to commit tokens/keys in your project. 1 Link to comment Share on other sites More sharing options...
Share Posted January 27 2 minutes ago, Prasanna said: Yes it does, but as a practice it is recommended no to commit tokens/keys in your project. Just removes the hassle of setting env var NPM_TOKEN for every yarn command 😮 Any idea why setting global registry to npm.greensock.com works lol? You think there's some kind of fallback system that yarn and npm use if the registry endpoint doesn't return a package? As in, there's no issue installing any other packages even though registry is set globally to greensock domain? Link to comment Share on other sites More sharing options...
Share Posted January 27 7 minutes ago, thirsty said: Any idea why setting global registry to npm.greensock.com works lol? You think there's some kind of fallback system that yarn and npm use if the registry endpoint doesn't return a package? As in, there's no issue installing any other packages even though registry is set globally to greensock domain? The registry service used by npm.greensock.com uses the official npm registry as fallback registry. Hence you would still be able to install all packages when you set npm.greensock.com as the global registry. There is no problem with configuring npm.greensock.com as the global registry but package installation could be slower in some cases (in cases when the package requested is not readily available in the npm.greensock.com registry) As for the fallback registry, it is currently not possible to set two global registries. But you can set a registry for scoped packages and use global registry as a fallback. Link to comment Share on other sites More sharing options...
Share Posted January 27 6 minutes ago, Prasanna said: The registry service used by npm.greensock.com uses the official npm registry as fallback registry. Hence you would still be able to install all packages when you set npm.greensock.com as the global registry. There is no problem with configuring npm.greensock.com as the global registry but package installation could be slower in some cases (in cases when the package requested is not readily available in the npm.greensock.com registry) As for the fallback registry, it is currently not possible to set two global registries. But you can set a registry for scoped packages and use global registry as a fallback. Ah ok, interesting, probably not the best to rely on greensock for all of our dependancies. It's weird that @gsap:registry='...' doesn't work to single out the gsap repository? Even though it works locally, I'll check what yarn version netlify uses Link to comment Share on other sites More sharing options...
Share Posted January 27 1 hour ago, thirsty said: Ah ok, interesting, probably not the best to rely on greensock for all of our dependancies. Yes, please don't do that 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