Cloud IDE provides version managers to simplify handling of multiple versions of Node.js and Ruby. With version managers, you can install, manage, and switch between different versions and enhance flexibility and efficiency in development workflows.
Node Version Manager (NVM) is a version manager for Node.js, which is installed per user and invoked per shell.
To install a different version of Node.js:
Run the nvm install
command and pass the target version.
ide:~/project (master #) $ nvm install 14.19.1
Downloading and installing node v14.19.1...
Downloading https://nodejs.org/dist/v14.19.1/node-v14.19.1-linux-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v14.19.1 (npm v7.21.1)
To use the newly installed version:
Run the nvm use <version>
command:
ide:~/project (master #) $ nvm use 14.19.1
Now using node v14.19.1 (npm v7.21.1)
When the IDE hibernates, all active shell sessions are lost. To set a default version that persists through hibernation, use nvm alias default
instead of nvm use
.
To verify that you are running the target version:
Run the node -v
command:
ide:~/project (master #) $ node -v
v18.17.0
Ruby Version Manager (RVM) is a command-line tool that helps you to install, manage, and work with multiple Ruby environments. It helps to ensure that all aspects of Ruby are contained within the user space.
To view the list of existing versions of Ruby:
Run the rvm list
command:
ide:~/project $ rvm list
=* ruby-2.4.9 [ x86_64 ]
# => - current
# =* - current && default
# * - default
To install a different version of Ruby:
Run the rvm install
command and pass your target version:
ide:~/project $ rvm install 2.7.2
Searching for binary rubies, this might take some time.
No binary rubies available for: debian/bullseye_sid/x86_64/ruby-2.7.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for debian.
Installing requirements for debian.
.....
Installing required packages: libreadline6-dev...
Requirements installation successful.
Installing Ruby from source to: /home/ide/.rvm/rubies/ruby-2.7.2, this may take a while depending on your cpu(s)...
ruby-2.7.2 - #downloading ruby-2.7.2, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 14.0M 100 14.0M 0 0 27.7M 0 --:--:-- --:--:-- --:--:-- 27.6M
ruby-2.7.2 - #extracting ruby-2.7.2 to /home/ide/.rvm/src/ruby-2.7.2.....
ruby-2.7.2 - #configuring........................................................................
ruby-2.7.2 - #post-configuration..
ruby-2.7.2 - #compiling............................................................................................................
ruby-2.7.2 - #installing..................
ruby-2.7.2 - #making binaries executable...
Installed rubygems 3.1.2 is newer than 3.0.9 provided with installed ruby, skipping installation, use --force to force installation.
ruby-2.7.2 - #gemset created /home/ide/.rvm/gems/ruby-2.7.2@global
ruby-2.7.2 - #importing gemset /home/ide/.rvm/gemsets/global.gems................................................................
ruby-2.7.2 - #generating global wrappers.......
ruby-2.7.2 - #gemset created /home/ide/.rvm/gems/ruby-2.7.2
ruby-2.7.2 - #importing gemsetfile /home/ide/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.7.2 - #generating default wrappers.......
ruby-2.7.2 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.7.2 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
To view the newly installed version:
Run the rvm list
command:
ide:~/project $ rvm list
=* ruby-2.4.9 [ x86_64 ]
ruby-2.7.2 [ x86_64 ]
# => - current
# =* - current && default
# * - default
To switch to the newly installed version:
Run the following commands:
ide:~/project $ /bin/bash --login
ide:~/project $ rvm use 2.7.2
Using /home/ide/.rvm/gems/ruby-2.7.2
ide:~/project $ rvm list
* ruby-2.4.9 [ x86_64 ]
=> ruby-2.7.2 [ x86_64 ]
# => - current
# =* - current && default
# * - default
If this content did not answer your questions, try searching or contacting our support team for further assistance.
Thu Nov 21 2024 05:48:16 GMT+0000 (Coordinated Universal Time)