Jump to content
Search Community

Prasanna

Members
  • Posts

    61
  • Joined

  • Last visited

Posts posted by Prasanna

  1. 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
  2. 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
  3. On 3/28/2021 at 11:57 PM, billyZduke said:
    //npm.greensock.com/:_authToken={token}
    //registry.npmjs.org/:_authToken={token}
    @gsap:registry=https://npm.greensock.com

     

    The config seems to be fine on your local machine. But to deploy to netlify you need to use environment variables. Here's a detailed guide how you can do the same:
    https://answers.netlify.com/t/support-guide-using-private-npm-modules-on-netlify/795

    (Apologies for the delay in my response. I forgot to hit the submit button 🤦‍♂️)

    • Like 1
  4. 8 hours ago, billyZduke said:

    I deleted the entire node_modules folder and both lockfiles before running yarn and npm install commands... it doesn't seem that any other versions of gsap should have survived that...

     

    In poking around further, I noticed you now offer methods to download the private packages from npm.greensock.com, which I did get to work with yarn (following directions in another thread), but not with npm (which I still apparently need because Netlify is unavoidably using npm ci at some point during the build process). This is where I'm at now, with .npmrc set up with my token, trying to run npm i:

     

    403 Forbidden - GET https://npm.greensock.com/@gsap%2fshockingly/-/shockingly-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.

     

     

     

    Could you share the .npmrc file (without the token)?

    • Like 1
  5. UPDATE: This issue seems to have been solved in yarn berry. Here's how you could use it the package in yarn berry:

     

    Create a .yarnrc.yml file in your project root and add the following:

    nodeLinker: node-modules
    npmScopes:
      gsap:
        npmRegistryServer: "https://npm.greensock.com"
        npmAlwaysAuth: true
    npmRegistries:
      //npm.greensock.com:
        npmAlwaysAuth: true
        npmAuthToken: "<your-token-here>"

     

    Then run the following commands in the terminal:

    $ yarn set version berry
    $ yarn add gsap@npm:@gsap/shockingly@*

    You might have to delete the existing yarn.lock file to support yarn berry.
     

    • Like 1
    • Thanks 1
  6. There seems to be a problem with yarn and package aliases (More info here: https://github.com/yarnpkg/yarn/issues/8584)

     

    So, if you really need to deploy with yarn to netlify/vercel then you need to try either of these workarounds:

    1. Delete yarn.lock file from the project and deploy

    or

    2. add registry=https://npm.greensock.com/ to the npmrc file of the project. Note that this will fetch all packages from greensock private registry.

    or

    3. Do not use package name alias. Install the package using `$ yarn add @gsap/shockingly` and use it as `import gsap from `@gsap/shockingly`

     

    Feel free to comment on the above github issue so that the maintainers of yarn releases a bugfix soon.

    • Like 2
  7. Well, that's very unlikely to happen. Following these steps always provide with successful installations:

    1. Delete yarn.lock file from the project

    2. Create .npmrc file in the project's root directory and add the following lines:

    //npm.greensock.com/:_authToken=${NPM_TOKEN}

    @gsap:registry=https://npm.greensock.com/

    3. Ensure that the package.json file does not contain `gsap` under dependencies/devDependencies

    4. Run: $ yarn add gsap@npm:@gsap/shockingly
    5. Push the code - if the ENV variables on netlify are configured properly, the installation should be good.

    • Like 2
×
×
  • Create New...