Jump to content
Search Community

NPMRC file with WordPress

Creativist-Lab test
Moderator Tag

Recommended Posts

Hello guys, sorry for this very newbie question. I just became a Club Greensock member so I have access to all the plugins.

But I'm kinda stuck with how to register via a NPMRC file. I watched the tutorial on how to do this but it doesn't go enough into detail about how to create this file (I'm a total noob with this process). Is there somewhere a more detailed video/tutorial on how to create this file and implement it into my website?

Just some additional info, I'm using WordPress, I already installed Node.js and I'm using VsCode on a Windows system.

Any help is much welcome and thanks in advance!

 

Cheers.

Link to comment
Share on other sites

Welcome aboard, @Creativist-Lab! Thanks for being a Club member. 

 

Maybe this will help: 

https://stackoverflow.com/questions/42877722/how-can-i-add-a-npmrc-file

 

But don't feel like you NEED to use the private NPM repository or an npmrc file - you can just download the bonus zip and use the gsap-bonus.tgz file in there. Drop it into your project directory and then run npm install ./gsap-bonus.tgz in the terminal and you're done. 👍

 

Good luck!

Link to comment
Share on other sites

Hello Jack thanks. So yeah the thing is even after trying to find some documentation on the things that you mention, I really have no knowledge (yet) on how to do this. There is so much information available but I can't seem to find the proper steps on how to do this on my WordPress site.

 

If  I understand you correct I need to setup a terminal between the editor that I'm using (VsCode) and my WordPress install, is this correct?

Because I need to run npm install ./gsap-bonus.tgz in VsCode and upload it to my project directory which is WordPress?

Sorry for these maybe very simple questions but I guess one has to start somewhere and I just have no clue how to take the proper steps to do this.

 

Thanks again.

Link to comment
Share on other sites

Hello guys, here I'm again. Since I still have no clue what I'm doing here I'm checking up with you guys if it is correct what I have done. I followed the GSAP instruction video after setting up VScode.

I created a NPMRC file in my project directory with the command prompt.

After this I installed GSAP also via the command line in this directory as shown in the instruction video.

So after this I got the following screen giving some warnings, so I don't know if everything went well.

 

When all if this is looking good my next step would be installing the plugins that I want to use by following "How to Install GSAP via Modules (npm, Yarn)"video and then just upload it to the server?

Again my apologies for these noob questions, hopefully I'm getting into the right direction now as this whole process has been taking me way too long ¯\_(ツ)_/¯

Thanks in advance.

GSAP-NPM.jpg

Link to comment
Share on other sites

If you're struggling this much with the NPM stuff, it may be easier for you to simply load the GSAP files via a simple <script> tag. The path you're taking is probably the most complex/tricky install which is only really helpful if you're developing in a certain type of environment (typically something that compiles/transpiles things for you). But none of that is necessary to use GSAP. 

 

I'm just concerned that you may have a wrong impression, like that using GSAP requires that you set up a whole Node.js environment, use bundlers, command line instructions, etc. None of that is the case. You could do a <script> tag, point it to the CDN URL and be done :)

 

I can't really tell if you got things installed correctly by simply looking at that screen shot, sorry. Those messages look like they have nothing to do with GSAP (except the one about updating). 

  • Like 1
Link to comment
Share on other sites

Hey Jack, thanks. Well I will go for that option if I can't get it to work via the NPM. I don't mind learning new things that's why I took this road first but yeah as you understand I have totally no experience with all of this. But it looks like I took the right steps and everything is uploaded and activated via the NPM route. If so it is an easy process (when you know what to do haha).

 

Anyways thanks for your help.

 

Cheers.

  • Like 1
Link to comment
Share on other sites

Those warnings are fine. It just means you didn't have a package.json in your project when you installed it. It's best to set one up first, which you can add by doing npm init in your terminal, but it probably already created it for you.

  • Like 1
Link to comment
Share on other sites

@OSUblake thanks for your message. I still didn't manage it completely via the NPM route, probably I need a bundler because I'm getting an error in the console saying: Uncaught SyntaxError: Cannot use import statement outside a module is my guess correct that I get this error because of not using a bundler?

Link to comment
Share on other sites

That means you're trying to using modules in a non module script. Scripts that use modules have a module type on them.

<script src="my-javascript.js" type="module"></script>

 

But you should probably just use a bundler and let it handler everything for you. It will combine, transform, and minify everything so you don't have to worry about that. Maybe check out of some of the simpler bundlers like Snowpack and Parcel. Webpack is the most popular, but I hate setting it up. 

 

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