I am trying to use Makefile to build Node projects. As a first step, I want to set node version using NVM. I tried the following code for that:
.PHONY: viz-ui
viz-ui:
. ${HOME}/.nvm/nvm.sh && nvm use 14.17.0
node -v
I set nvm use 16 before running make to test the output. After running make viz-ui, I get the following output:
. /home/vijayth2/.nvm/nvm.sh && nvm use 14.17.0
Now using node v14.17.0 (npm v6.14.13)
node -v
v16.14.2
In short, the node switch to 14.17.0 is not reflecting in the makefile, how can i fix it? Or what is the gap in my understanding of this?