Share Posted October 28, 2021 Hi, im have install gsap via npm following directions for greensock members using npm install gsap@npm:@gsap/simply I import it into my component ``` import drawSVG from 'gsap/DrawSVGPlugin'; gsap.registerPlugin(drawSVG); ``` An it seem to be working fine. When i push to git and build the project through Verce'ls hosting I get the following build error. Module not found: Can't resolve 'gsap/DrawSVGPlugin' in '/vercel/path0/components/Hero' Any ideas please Link to comment Share on other sites More sharing options...
Share Posted October 28, 2021 Hi James, You might have to do 2 install commands, like here... 1 Link to comment Share on other sites More sharing options...
Author Share Posted October 28, 2021 Hi thanks @OSUblake tried that and got ` Error: Command "npm install && npm install gsap@npm:@gsap/simply" exited with 1` Do I have to include the .npmrc authToken? Link to comment Share on other sites More sharing options...
Share Posted October 28, 2021 Yes. The auth token is how it verifies your GSAP account. Related thread... Link to comment Share on other sites More sharing options...
Author Share Posted October 28, 2021 Thank you. I watched all the video content and ended up downloading the tgz zip and installing. I presume i'm ok to upload this to my public repo? Link to comment Share on other sites More sharing options...
Share Posted October 28, 2021 We'd prefer you not as anyone could just snag that file. It would be better to make your repo private, or use .npmrc method. I don't have a good answer for on how to fix something works locally, but not on Vercel. It might be worth reaching out to them and seeing if they have a solution as it's their platform so they would have a better understanding of what the issue is. Another related thread... 1 Link to comment Share on other sites More sharing options...
Share Posted February 13 I'm getting a similar error, just different output: SyntaxError: Cannot use import statement outside a module. Tried the tgz method (also made sure that gitignore does not have .tgz), but i'm stuck. Any advice, please? Link to comment Share on other sites More sharing options...
Share Posted February 13 import { useEffect, useRef } from "react"; import { gsap } from "gsap/dist/gsap"; import { SplitText } from "gsap/dist/SplitText"; gsap.registerPlugin(SplitText); export default function HeroFadeText() { // Grab a reference to the component to split the text up. const heroText = useRef(null); useEffect(() => {}, []); return ( <div> <p ref={heroText}></p> </div> ); } Link to comment Share on other sites More sharing options...
Share Posted February 13 Hiya! Check out this thread - 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