DEV Community

Discussion on: How to run multiple Node and Angular versions simultaneously

Collapse
 
iranicus profile image
iranicus • Edited

Hey Patricia, just came across this article now and know the pain of operating across multiple angular version and node projects so this is very handy.

I set it up on my linux for my own personal projects and it seems after different node versions via nvm are installed and I run the "nvm run npm" start in the angular project directory I got a Cannot find module npm issue. I raised a ticket on the nvm github and yesterday I was told that after running "nvm use node version" its not necessary to run "nvm run npm start" due to the prior "nvm use" command being used.

Not sure if things have changed since you first uploaded this or not but wanted to pass that onto folks :>
If you are interested in the details of it the ticket can be found on: github.com/nvm-sh/nvm/issues/2284

Thanks now

Collapse
 
patricepeartree profile image
Patrícia Pereira

Hi. Yes, you're right, after nvm use you can execute only npm start and it will use the Node version you selected.

But actually the correct command to run npm as you were trying would be nvm exec npm start (not nvm run), maybe that's why you were getting an error? I see I have that command wrong in one of the sections of the post, I have a nvm run where a nvm exec should be (I'm going to edit that). Running the commands like this is only usefull if you have a .nvmrc file to avoid having to execute nvm use every time. But like you said, if you run nvm use, then you can actually just use the normal node and npm commands!