Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

221
Visualizações
Uncaught SyntaxError: Cannot use import statement outside a module (Trying to use Shepard.js Library )

I am trying to use Shepard.js for my web app.

I have installed the package using:

npm install shepherd.js --save

And I can see the folder in the node_modules folder in my web app's directory:

/Users/xxx/Desktop/Coding/anybody/anybody1/node_modules/shepherd.js

I have also checked I have node.js installed which I do.

When I try to follow the usage part of the Shepard Docs and add it to my js file I get this error:

Uncaught SyntaxError: Cannot use import statement outside a module

Here is how I have added it to my .js file:

import Shepherd from 'shepherd.js';

const tour = new Shepherd.Tour({
  defaultStepOptions: {
    classes: 'shadow-md bg-purple-dark',
    scrollTo: true
  }
});

tour.addStep({
  id: 'example-step',
  text: 'This step is attached to the bottom of the <code>.example-css-selector</code> element.',
  attachTo: {
    element: '#vygr-nav',
    on: 'bottom'
  },
  classes: 'example-step-extra-class',
  buttons: [
    {
      text: 'Next',
      action: tour.next
    }
  ]
});

tour.start();

I'm not quite sure what I'm doing wrong - this is my first time installing a library in JavaScript.

Thanks in advance for any help

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda