last day (23 days later) » 

6:04 AM
0
Q: How to upgrade node to specific version in macOS Mojave, and update the active path for node?

Archana SharmaI want to upgrade node to 12.10.0 and npm to 6.11.3, currently I am working on macOS Mojave version 10.14.5 I am using these commands to upgrade the node version to 12.10.0:: sudo npm cache clean -f (force) clear you npm cache sudo npm install -g n install n (this might take a while) sudo n 12...

 
@AnkurDubey I am already done with this still shows me same version. You can check above I am using the same command just clearing cache before this.
@AnkurDubey there might be problem in an active path of the node, suggest to me if you have a solution to change its active path.
 
You have nvm installed on your machine? I just upgrade my node to v12.11.1 and it's working absolutely fine.
 
@AnkurDubey No, I have not installed nvm yet.
 
Try nvm it will make things easy for you also with nvm you can use multiple node versions currently i have node 8, 10 and 12 installed in my macOS (Mojave) all i have to do is nvm use v8.9.4 if i want to use that version.
May i know which terminal you are using is it stock terminal or i-term?
 
6:13 AM
Hi Ankur
Can you suggest me article to install nvm
Currently I am using this one medium.com/@isaacjoe/…
 
First install brew : brew.sh
 
But it's not working for me
brew is already installed
 
perfect.
follow above steps.
also .bash_profile assuming you are using terminal.
 
ok, there is an issue in step 3, Back to your shell, activate nvm and check it (if you have other shells opened and you want to keep them, do the same) :
I have added that two lines inside my .bash_profile
After this when I am returning back to the shell and running source ~/.bash_profile command it shows me
-bash: export: No such file or directory
-bash: /usr/local/opt/nvm/nvm.s/nvm.sh: No such file or directory
 
you created the nvm directory?
 
6:26 AM
yes
by adding this mkdir ~/.nvm
 
can you show me your .bash_profile file
 
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/emulatorexport
export PATH="/usr/local/opt/node@10/bin:$PATH"
export PATH="/usr/local/opt/php@7.2/bin:$PATH"
export PATH="/usr/local/opt/php@7.2/sbin:$PATH"
alias composer="php /usr/local/bin/composer.phar"

source export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.s/nvm.sh
oh I have added source before export,
 
yes remove source before export
 
now it showing me nvm directory
but source ~/.bash_profile , still giving the same output
if I am running nvm -v, this gives me an output "-bash: nvm: command not found"
 
nvm --version
 
6:33 AM
same output
-bash: nvm: command not found
 
add these line in you bash profile :

export NVM_DIR="$HOME/.nvm"
. "/usr/local/opt/nvm/nvm.sh"
 
do I need to replace this with older one?
 
after that just closed your terminal and open again and then try again.
yep
 
great job :)
Now it's showing me nvm version
I have one question
 
perfect now just use nvm install v and any specific version you wanna install.
yes shoot.
 
6:37 AM
Inside bash profile, there is node path as
export PATH="/usr/local/opt/node@10/bin:$PATH"
Do I need to remove this??
 
no actually that's the reason you are getting v10 even after installing v12
but with nvm you don't need to worry about the versions anymore you can use any version whenever you needed.
But even after installing any version with nvm if you still face any issue simply remove that line.
 
Yeah! you are right. Great job buddy thanks a lot.
I have one request
 
your welcome :)
sure.
?
 
As I am new to frontend development. Please add me in your development groups if possible. I really love to learn new things.
Or you can also suggest me some place where developers having a conversion over specific topics.
 
I'm not using group feature yet but feel free to contact me on my my email : ankursaitanz@gmail.com
yes there are few channels where you can ask regarding the library you are using.
 
6:44 AM
Thank you so much. Have a nice day
 
Thanks and you too :)
 
please upvote my question :)
 
please mark my answer as correct one and sure i'll do that.

JavaScript

Topic: Anything JavaScript, ECMAScript including Node, React, ...

React.js

this.setState({ status: 'open', description: 'React talk ...' });
 
Thanks Ankur
 
https://chat.stackoverflow.com/

you can find other chats channel.
no worries happy to help :)
 
6:50 AM
ok, THANKS.
I am not able to find your answers in above mentioned links
I got it. Have a nice day!
 

last day (23 days later) »