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
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!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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
Hi. Yes, you're right, after
nvm use
you can execute onlynpm 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
(notnvm 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 anvm run
where anvm 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 executenvm use
every time. But like you said, if you runnvm use
, then you can actually just use the normalnode
andnpm
commands!