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

457
Visualizações
How are locally and globally installed packages different?

How are packages installed with the command

$ npm i -g <package_name>

different from the packages installed with the following command?

$ npm i <package_name>
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

The main difference between the locally installed and globally installed packages is that

  1. locally installed packages are kept inside the same directory that you run the npm install <package_name> and these packages are kept in the node_modules folder under that same directory.

  2. globally installed packages are all kept in the same directory(the exact location depends upon your system setup). These packages are kept in the same directory regardless of where you run the npm install -g <package_name> from.

Generally, it is suggested to install packages locally since updating a global package causes every application using that specific package to use the updated package and you might have to do the maintainence work, which is basically a nightmare.

about 4 years ago · Juan Pablo Isaza Relatório

0

Locally installed packages are installed under node_modules folder. They are not accessible by other npm projects you have. Each npm project, initialized with npm init, has its own node_modules folder.

On the other hand, globally installed packages are installed in the same folder of your system.

When you import a package with

require('package-name');

You're importing it from your local packages under node_modules.

It's advisable to avoid installing packages globally. Usually, you only install global packages when they provide CLI functionalities (Scripts that you run from you terminal, using bash, shell, etc).

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