Node JS required and settings
Connect to the VM again (in case you exit or loose connection):
Code Block |
---|
ssh root@<IP address> |
where - the address of the VM for deploy
...
Install node with Ubuntu package manager
Source to install for Ubuntu only for one user: https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04
If You are going to use autodeploy under other user (for example gitlab-runner user) each changes of the Marionette project settings (Marionette Stack) You should install Node JS available to all users of the VM operation system. Use apt
to install the nodejs
package from Ubuntu’s default software repository.
Here is installing Node JS available to all Users with nvmUbuntu package manager:
Code Block |
---|
cd ~
apt update |
...
apt update |
Then install Node.js:
Code Block |
---|
apt install nodejs |
Install the npm package manager:
Code Block |
---|
apt install npm |
Verify you’ve installed the required version:
Code Block |
---|
mkdir /usr/local/nvmnode -v |
Install node with Node Version Manager
Another way to install Node.js that is quite flexible is to use nvm, or Node Version Manager. This software allows you to install and maintain several different independent versions of Node.js and their associated Node packages.
Code Block |
---|
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.38.0/install.sh | NVM_DIR=/usr/local/nvm bash |
Enter to folder /etc/profile.d add create there file nvm.sh
Code Block |
---|
cd /etc/profile.d && vi nvm.sh |
Fill the nvm.sh file next
Code Block |
---|
#!/usr/bin/env bash
export NVM_DIR="/usr/local/nvm"
source /usr/local/nvm/nvm.sh
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" #loads nvm |
Make /etc/profile.d/nvm.sh as source:
Code Block |
---|
source /etc/profile.d/nvm.sh |
Install nvm:
Code Block |
---|
nvm install --lts |
or
# Look at the list of the node versions
nvm list-remote
# install any
nvm install [version] |
where [version] - newest recommended LTS version from the node list versions
Type and run next command for export necessary paths to all users (not necessary):
Code Block |
---|
n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local |
Verify you’ve installed the required version
Code Block |
---|
node -v |
You'll getIn both cases, you will receive, for example, a similar answer of the version response:
...