-1

When installing packages using nodejs, what happens if you run the same command multiple times, i.e. "npm install -g cordova ionic"?

Does this cause problems/issues? Or does it automatically recognize that you have it installed and nothing really happens? Thanks.

RienNeVaPlu͢s
  • 7,442
  • 6
  • 43
  • 77
user1142130
  • 1,617
  • 3
  • 20
  • 34

1 Answers1

0

Usually nothing of note, but it simply "installs what you tell it to". npm installs to ./node_modules relative to where you run it, and installs whatever version is specified, or "the latest one" if you don't specify any version. If there is already a dependency dir for what you're installing, that's deleted, and then the thing you're telling npm to install is put in its place.

Does that cause problems? Only if you let it. If it deletes and reinstalls, the net effect is no change. If it deletes a specific version and replaces it with a different version, then that might be a problem, but a problem of your own making: this is what the package.json dependencies list is for, so that npm install installs exactly what you need it to.

Mike 'Pomax' Kamermans
  • 49,297
  • 16
  • 112
  • 153