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

170
Visualizações
Why did I lose my javascript file to npm?

I wrote up a small library, just a .js file with some frequently used functions, and dropped it into the node_modules folder so it was alongside all of my other packages. Great.

A few days later, I added a new package with npm install. When I ran the program to test it, I got errors for my library missing, and sure enough it was no longer in the node_modules folder, recycling bin, or even appearing in my source control because I gitignore'd the folder.

As someone who's new to projects that use more than a handful of files, could someone please explain what may have caused this, and how I can prevent it in the future?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

node_modules isn’t for your own files; it’s managed entirely by npm based on the contents of your package.json. You should put those in the directory that contains node_modules, and load them with relative imports (import foo from './foo' or require('./foo')).

about 4 years ago · Juan Pablo Isaza Relatório
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