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

286
Visualizações
share node.js modules across React apps?

I'm trying out node.js and npm for the first time, to code a React tutorial using the Create React App boilerplate.

The first simple app is working fine.

The file structure looks like this (Windows 7):

file structure of node.js app created with the Create React App boilerplate

My concern is that the node_modules folder is 70mb on file and occupies 120mb on the disk.

It seems that each time I create a new app via Create React App, the same folder is going to get re-created for the new app, and occupy a similar vast amount of storage.

My question is: is there some way to create new apps such that the same modules are not downloaded and don't end up occupying more and more storage, and can instead be shared across apps (not sure if node.js philosophy supports sharing of such modules).

Update: I have supplied my own answer to this question.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

You can install npm modules globally with the flag -g, like so:

# npm install -g jshint

That way they would be accessible to all your projects. See docs on npm install for details.

P.S. Separate advice - make sure you use somehat new (>=3.X) version of npm - otherwise you might run into problems with long file paths on Windows.

over 4 years ago · Santiago Trujillo Relatório

0

I'm new to the node.js and npm way of doing things. It seems that this is the normal way of doing things, and dependencies are scoped to single projects. There are many advantages to doing it this way, and I no longer want to share the modules folder across different projects.

over 4 years ago · Santiago Trujillo 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