Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Yellow Car

gsap business installation error (ERR! code E403 - You must be  logged in to install/publish packages.)

Recommended Posts

6 months ago, I succeeded to install gsap business and all worked great. but today I decided to start a new project and I can not get gsap/business to work. 

 

I did put the appropriate code in my .npmrc file.

 

but when I run npm install, I get errors about not being logged in.

 

(logged into what? In my browser I am logged into gsap. And also github. What else can I possibly log in to?)

 

PS C:\Users\chris\vscode\donut> npm install gsap@npm:@gsap/business
npm ERR! code E403
npm ERR! 403 403 Forbidden - GET https://npm.greensock.com/@gsap%2fbusiness/-/business-3.6.1.tgz - You must be 
logged in to install/publish packages.
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.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\chris\AppData\Local\npm-cache\_logs\2021-04-26T22_02_43_858Z-debug.log
PS C:\Users\chris\vscode\donut>

Link to comment
Share on other sites

So I tried opening this link in my browser (chrome).

And it just shows the error in my browser as json data.

This is the same browser I am using to post this message, so I don't see how I could be "not logged in".

{
  "error": "You must be logged in to install/publish packages."
}
Link to comment
Share on other sites

Sorry to hear about the trouble, @Yellow Car. Hm. Just to be clear, the whole "not logged in" thing has nothing to do with the browser or you being logged into the greensock.com site. The private NPM repo itself is trying to validate your token and failing. I wonder if you tried clearing your lock file and cache, that may help. I assume you followed the install instructions too. 

 

Also, you aren't using yarn, are you? That ecosystem has some known bugs that [to my knowledge] haven't been fixed. 

 

I believe there are some problems with NPM 7.x that introduced a bug with private repo authentication. You could try running these two install commands:

npm install @gsap/business
npm install gsap@npm:@gsap/business

The reason why we need two install commands is because the first command inserts the correct package into the npm cache. So the next command will be able to retrieve the package directly from the npm cache. 

  • Like 1
Link to comment
Share on other sites

1. I am using NPM.

2. Yes, I cleared my lock file.

3. No, I did not clear my cache. I do not know how to do that, actually. If you can clarify, I would appreciate it.

Thanks for your suggestions.

-yc

Link to comment
Share on other sites

I will try npm cache clean. and then attempt to install again.

Link to comment
Share on other sites

npm cache clean gives these errors...

PS C:\Users\chris\vscode\donut> npm cache clean
npm ERR! As of npm@5, the npm cache self-heals from corruption issues
npm ERR! by treating integrity mismatches as cache misses.  As a result,
npm ERR! data extracted from the cache is guaranteed to be valid.

Link to comment
Share on other sites

So, I rebooted my pc just in case that might help. 

Then I made an empty folder.

I ran npm init there to create the package.json file.

I then created the .npmrc file and copied code as suggested by my gsap install instructions.

I tried to clean cache, but as noted above, this led to npm errors saying the cache cannot get corrupted.

Then I tried again with...

npm install gsap@npm:@gsap/business

Errors are the same as before...

 

PS C:\Users\chris\vscode\hopscotch> npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help init` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (hopscotch) 
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to C:\Users\chris\vscode\hopscotch\package.json:

{
  "name": "hopscotch",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Is this OK? (yes)
PS C:\Users\chris\vscode\hopscotch> npm install gsap@npm:@gsap/business
npm ERR! code E403
npm ERR! 403 403 Forbidden - GET https://npm.greensock.com/@gsap%2fbusiness/-/business-3.6.1.tgz - You must be logged in to install/publish packages.
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.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\chris\AppData\Local\npm-cache\_logs\2021-04-27T01_30_11_563Z-debug.log
PS C:\Users\chris\vscode\hopscotch>

 

Link to comment
Share on other sites

PS C:\Users\chris\vscode\hopscotch> ls


    Directory: C:\Users\chris\vscode\hopscotch


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         4/26/2021   9:29 PM            110 .npmrc
-a----         4/26/2021   9:27 PM            205 package.json


 

Link to comment
Share on other sites

contents of .nmprc are...

//npm.greensock.com/:_authToken=********-****-****-****-************
@gsap:registry=https://npm.greensock.com

 

(asterisks added only for sake of posting to this message board)

Link to comment
Share on other sites

Thanks for the info! What does the "gsap" part of your package.json file say? 

 

I'm also curious if you tried just npm install gsap

Link to comment
Share on other sites

Can you try doing this: Delete the .npmrc file in the project then run the following commands (don't forget to replace the <your-auth-token> with the correct token

 

$ npm config set @gsap:registry https://npm.greensock.com/
$ npm config set //npm.greensock.com/:_authToken <your-auth-token>
$ npm install @gsap/business
$ npm install gsap@npm:@gsap/business

This should solve the issues :) 

 

Let me know if it still doesn't work

 

  • Thanks 2
Link to comment
Share on other sites

Prasanna,

Yes. This did indeed solve my problem.

Thank you very, very much.

-yc

 

  • Like 1
Link to comment
Share on other sites

Follow up question... Can you explain why you suggested this solution? What exactly is going on here?

Link to comment
Share on other sites

Indeed, @Prasanna, it'd be super cool if you could share some of the "why" behind the solution. 

 

@Yellow Car, @Prasanna is our resident guru of all things with the private registry. Super knowledgeable. 

  • Like 1
Link to comment
Share on other sites

Hey @Yellow Car, this is what's going on when you execute each commands:

 

$ npm config set @gsap:registry https://npm.greensock.com/

^ This command adds the following entry to the ~/.npmrc file:
@gsap:registry=https://npm.greensock.com


$ npm config set //npm.greensock.com/:_authToken <your-auth-token>

^ Just like the previous this command adds the following entry to the ~/.npmrc file:
//npm.greensock.com/:_authToken=<your-auth-token>

 

You might notice that the above entries are the exact lines specified in the Greensock installation docs. But sometimes, manual errors might cause some issues while entering data into the .npmrc file like adding/missing an extra space/character. These commands just prevents the same from happening.


$ npm install @gsap/business

^ This command is required to fill the npm cache in npm v7. I'ts a weird bug introduced in the npm v7 that causes installation failures while using package name aliases


$ npm install gsap@npm:@gsap/business

Finally, this is the command that installs the package "@gsap/business" and gives it an alias name "gsap". As a result, you can import code from the business package like all other regular greensock packages: import GSAP from 'gsap'  - this will import code from @gsap/business package in our case

 

Pretty cool huh? 

  • Like 1
  • Thanks 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.
×