How to install Node.js in Manjaro Linux

Published on 2018/03/10 ‚óŹ Last updated on 2018/09

Table of contents

Installation process

Install asdf

Version managers rule in dev environments.
So we will install Node.js using asdf.


Clone the GitHub repository:

git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.5.0

Add some lines to your .profile and .bashrc files:

echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.profile
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc

Make changes effective with:

source ~/.profile
exec $SHELL

We add asdf.sh to .profile and not to .bashrc, because it will have the side effect of allowing applications started through dmenu —for i3 users— to have the node command available.

This is because stuff in .profile gets loaded when you login into your account, so anything there will be available to commands run through dmenu or desktop icons.

But, stuff in .bashrc gets loaded everytime you open a terminal —so another solution, would be to just start code from the CLI.

Install Node.js

Let’s install the latest release of node:

asdf plugin-add nodejs
bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring

asdf list-all nodejs
asdf install nodejs 10.11.0
asdf global nodejs 10.11.0

Add the Yarn package manager globally:

npm install -g yarn

If you are a Vue.js fan —and why shouldn’t you be one? :)— install vue-cli:

yarn global add @vue/cli @vue/cli-init

# After installing a global package with Yarn, you usually need to run:
asdf reshim nodejs

If for any reason, you can’t find the vue executable, try with npm:

npm install -g @vue/cli

Test it out by printing out the vue-cli version:

vue --version

You should see something like:

3.0.3

Now you can create a new Vue.js project with:

vue create my-new-project

Links


— lt

Feedback & comments

Get in touch on Twitter

Or by good ol' email at adriandcs@gmail.com