Jump to content
Search Community

Netlify deploy error with greensock-member

Gr0x test
Moderator Tag

Go to solution Solved by Gr0x,

Recommended Posts

Hello Cassie :)

Oh, i see! 

 

I've tried the links without succeed.. 

 

Tried to create a variable in Netlify that connects my token to commented line in the App.js

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

 

Not sure if my location of the .npmrc-file matters? (C:\Users\Name\.npmrcs)

Link to comment
Share on other sites

Taken from that thread - It looks like the .npmrc file should be in the project root. - Did you see these steps?

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 1
  • Thanks 1
Link to comment
Share on other sites

So here what I have done now.

 

1. added the token id to .npmrc file

2.  yarn add gsap@npm:@gsap/member (installation went well)

3. changed back the "//npm.greensock.com/:_authToken=<my_token>" to "//npm.greensock.com/:_authToken=${NPM_TOKEN}"

4. check so I have a enviroment variable in Netlify (as the link you sent me from them).

5. tried to deploy it, with the same error massage as everythin started with..

 

6:23:19 PM: [2/4] Fetching packages...
6:23:21 PM: error An unexpected error occurred: "https://npm.greensock.com/@gsap%2fmember/-/member-3.6.1.tgz: Request failed \"403 Forbidden\"".
6:23:21 PM: info If you think this is a bug, please open a bug report with the information provided in "/opt/build/repo/yarn-error.log".
6:23:21 PM: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
6:23:43 PM: Error during Yarn install
6:23:43 PM: Build was terminated: Build script returned non-zero exit code: 1
6:23:43 PM: Creating deploy upload records
6:23:43 PM: Failing build: Failed to build site
6:23:43 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
6:23:43 PM: Finished processing build request in 36.15330949s
Link to comment
Share on other sites

Here's how you can use the club gsap packages on netlify:
 

Steps:

1. Add a .npmrc to the root of the project and type in the following:

```

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

```

 

Please note that after adding this file npm install in the project fails as the local environment variable is not specified. To solve this you can either set the environment variable in your machine, or run the npm commands with env prefix like this:$env NPM_TOKEN="<your token>" npm install. Or, you can also temporarily rename the .npmrc file to any other filename and revert the changes before pushing the same to git.

 

2. Configure the environment variable in netlify like this(use your token under value):

image

 

That's all. The installs should then be working fine for you :)

 

Let me know if you're stuck at any point

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Hello Prasanna! :)

 

This is exactly what I have done, without any succeed :( 

 

Except for the "always-auth=true" thingy. I will try it asap and see how it goes :) 

 

 

This is what I got now (I added the "always-auth=true"):

 

11:03:16 PM: Installing NPM modules using Yarn version 1.22.4
11:03:17 PM: yarn install v1.22.4
11:03:17 PM: [1/4] Resolving packages...
11:03:18 PM: [2/4] Fetching packages...
11:03:20 PM: error An unexpected error occurred: "https://npm.greensock.com/@gsap%2fmember/-/member-3.6.1.tgz: Request failed \"403 Forbidden\"".
11:03:20 PM: info If you think this is a bug, please open a bug report with the information provided in "/opt/build/repo/yarn-error.log".
11:03:20 PM: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
11:03:44 PM: Error during Yarn install
11:03:44 PM: Build was terminated: Build script returned non-zero exit code: 1
11:03:44 PM: Creating deploy upload records
11:03:44 PM: Failing build: Failed to build site
11:03:44 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
11:03:44 PM: Finished processing build request in 38.686758233s
Edited by Gr0x
Link to comment
Share on other sites

I've managed to get a reduced test case deployed on netlify following @Prasanna's instructions - both with the Netlify env variables and with the token in the .npmrc file.

My .npmrc file -
 

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

On Netlify -

Screenshot 2021-05-13 at 16.37.18.pngThis is a fake token btw - just in case anyone's being sneaky.

  • Like 3
Link to comment
Share on other sites

AH, this was due to my misunderstanding on my part - It worked but Prasanna let me know that adding the registry actually breaks the installation, we're only applying the the Auth token for gsap packages. So the gsap package installation succeeds and the other package installations will fail.

 - I did get a couple of intermittent failed 403 errors though - But I removed that line, tried to deploy again and it did work without it.

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

@Prasanna

 

Here is a screenshot :) 

Skärmbild (54).png

 

Here is the code that is in the .npmrc-file

 

 always-auth=true  

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

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

 

 

(im still having error message as before, in Netlify deploy) 

  • Like 3
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...