Gr0x Posted May 11, 2021 Share Posted May 11, 2021 Hey guys I'm trying to publish my portfolio now via Netlify (github repo). While I am mid/end deploying there is an error message (linking 2 pictures). Link to comment Share on other sites More sharing options...
Cassie Posted May 11, 2021 Share Posted May 11, 2021 I'm afraid I'm an npm gal, but maybe this thread can help? 1 Link to comment Share on other sites More sharing options...
Gr0x Posted May 12, 2021 Author Share Posted May 12, 2021 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 More sharing options...
Cassie Posted May 12, 2021 Share Posted May 12, 2021 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. 1 1 Link to comment Share on other sites More sharing options...
Gr0x Posted May 12, 2021 Author Share Posted May 12, 2021 So this is the current issue I'm dealing with now. I'm at "step 4: Run: $ yarn add gsap@npm:@gsap/shockingly" I'm getting this message in my terminal (adding picture) Link to comment Share on other sites More sharing options...
Cassie Posted May 12, 2021 Share Posted May 12, 2021 And you reckon you've got the netlify side of things set up correctly?https://answers.netlify.com/t/support-guide-using-private-npm-modules-on-netlify/795 Link to comment Share on other sites More sharing options...
Gr0x Posted May 12, 2021 Author Share Posted May 12, 2021 I do The error code comes from when I want to do "step 4" Link to comment Share on other sites More sharing options...
Cassie Posted May 12, 2021 Share Posted May 12, 2021 Maybe this will help. (I have to admit I am just wildly googling and I don't have the faintest clue.)https://stackoverflow.com/questions/52015748/npm-failed-to-replace-env-in-config-npm-token 1 Link to comment Share on other sites More sharing options...
Gr0x Posted May 12, 2021 Author Share Posted May 12, 2021 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 More sharing options...
Cassie Posted May 12, 2021 Share Posted May 12, 2021 And this is working locally - just failing on netlify? Link to comment Share on other sites More sharing options...
Prasanna Posted May 12, 2021 Share Posted May 12, 2021 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): That's all. The installs should then be working fine for you Let me know if you're stuck at any point 1 1 Link to comment Share on other sites More sharing options...
Gr0x Posted May 12, 2021 Author Share Posted May 12, 2021 (edited) 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 May 12, 2021 by Gr0x Link to comment Share on other sites More sharing options...
sybilrondeau Posted May 13, 2021 Share Posted May 13, 2021 hi @Gr0x, I am exactly in the same situation. Did you find out how to deploy ? Link to comment Share on other sites More sharing options...
Cassie Posted May 13, 2021 Share Posted May 13, 2021 Hi pals, I'm having a chat with someone at Netlify later today. I'll see if they have any input. Hold tight, we'll figure it out. 2 Link to comment Share on other sites More sharing options...
Gr0x Posted May 13, 2021 Author Share Posted May 13, 2021 Hey buddy! @sybilrondeau No I haven't 1 Link to comment Share on other sites More sharing options...
Prasanna Posted May 13, 2021 Share Posted May 13, 2021 @Gr0x - could your share a screenshot of the .npmrc file in the project? I think there could be a very minor issue in the configuration Link to comment Share on other sites More sharing options...
Cassie Posted May 13, 2021 Share Posted May 13, 2021 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 - This is a fake token btw - just in case anyone's being sneaky. 3 Link to comment Share on other sites More sharing options...
sybilrondeau Posted May 13, 2021 Share Posted May 13, 2021 Hi @Cassie ! I tried with the tips on your previous post and it worked ! Why did you delete it ? With registry=https://npm.greensock.com added to the .npmrc 2 Link to comment Share on other sites More sharing options...
Cassie Posted May 13, 2021 Share Posted May 13, 2021 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. 3 1 Link to comment Share on other sites More sharing options...
sybilrondeau Posted May 13, 2021 Share Posted May 13, 2021 Ok, thank you for your help ! 1 Link to comment Share on other sites More sharing options...
Cassie Posted May 13, 2021 Share Posted May 13, 2021 Did you manage to get it working without the registry line? Link to comment Share on other sites More sharing options...
sybilrondeau Posted May 13, 2021 Share Posted May 13, 2021 Well I pushed again on Github and it seems it is still working... 1 Link to comment Share on other sites More sharing options...
Cassie Posted May 13, 2021 Share Posted May 13, 2021 Hooray! That's what happened to me. I'm not questioning it. 2 Link to comment Share on other sites More sharing options...
Gr0x Posted May 13, 2021 Author Share Posted May 13, 2021 @Prasanna Here is a screenshot 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) 3 Link to comment Share on other sites More sharing options...
Gr0x Posted May 14, 2021 Author Share Posted May 14, 2021 @sybilrondeau Hey buddy! Did you manage it to work or are you still getting the netlify error message at deploy? 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