Jump to content
Search Community

TypeError: The specifier “gsap” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”

Ferrari test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

Hello,

I using Vanilla JS and I installed gsap from npm I get this message  when I want to import gsap , TypeError: The specifier “gsap” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/” 

import { gsap } from "gsap";

why this happen?

Link to comment
Share on other sites

  • Solution

Hi @Ferrari and welcome to the GreenSock forums!

 

Thanks for being a Club GreenSock member and supporting GreenSock! ?

 

The only reason I can think of is because you are not using a build tool like webpack, vite, parcel, etc. So basically the browser is trying to find a gsap module in a path that doesn't exists.

 

If you keep having issues please create a minimal demo in Stackblitz that clearly illustrates the problem you're having.

 

Hopefully this helps.

Happy Tweening!

  • Like 1
Link to comment
Share on other sites

Yeah, I think that's a browser requirement when you do a <script type="module">. You've got to include an actual path, and you also may need to include the file name, like: 

import { gsap } from "./gsap.js";

(but obviously make sure you use the appropriate path to wherever you put the GSAP file relative to your document). 

  • Like 1
Link to comment
Share on other sites

18 hours ago, Rodrigo said:

yes it's true I don't used nothing tools as vite or webpack. Ok now  I installed Vite and I want to install gsap on my project and I get error .

I installing as wrote in instruction, on my dashboard, but this doesn't worked

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

 

 

Link to comment
Share on other sites

19 hours ago, Rodrigo said:

I solved this problem with 

$ npm config set @gsap:registry https://npm.greensock.com/
$ npm config set //npm.greensock.com/:_authToken <your-auth-token>
$ npm install @gsap/shockingly
$ npm install gsap@npm:@gsap/shockingly

 

 

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