1

I'm working with nvm to run version 14.17.0 of node:

nvm current
v14.17.0

I'm inside the folder of a project with package.json and package-lock.json files.

I need to install the project's dependencies so I try to run nvm install, but I soon realize that that command is actually for Download and install a <version>, [-s] from source.

My question is: how do I install the project's dependencies defined in package.json when using nvm?

Reading the nvm help didn't clarify my question and when I google this, I only find results about how to install nvm.

Xar
  • 7,572
  • 19
  • 56
  • 80

1 Answers1

2

nvm is for managing your node version; you want npm install.

Frankenstein was the guy who did the mad science; you want "Frankenstein's monster".

Connor Low
  • 5,900
  • 3
  • 31
  • 52
  • Thank you for the answer @Connor Low. One more question if you don't mind. When I run `nvm current`, I get `v14.17.0`, but if I then run `npm -v`, it returns `6.14.13`. Is this normal? – Xar Nov 01 '21 at 16:34
  • 1
    Yes, but `node -v` should match. npm is a package manager for node, similar to yarn. node is the actual server and what nvm is for. See [this question](https://stackoverflow.com/questions/41675848/what-is-the-difference-between-node-js-runtime-and-npm-package-manager-options-w/41676076), particularly [this answer](https://stackoverflow.com/a/46904463/6789816). – Connor Low Nov 01 '21 at 16:36
  • It does match. Thank you! – Xar Nov 01 '21 at 16:39