Update NodeJS Version on Business Application Studio : 2021
Hi all, you may have heard, or would have started using SAP Business Application Studio (BAS). It is the next generation of SAP Web IDE & available as a cloud service.
BAS provides 5 possible DEV spaces
- SAP Fiori
- SAP Cloud Business Application
- SAP HANA Native Application
- SAP Mobile Application
I was working on an application in SAP Cloud Business Application space & was getting error while starting the same post development. It came out, BAS was using an older version of NodeJS which resulted in the issue. I tried finding some reference blogs to update it, but found none. So, when I was finally able to resolve this, I thought of sharing the same with the community.
Access Terminal on BAS
Firstly, we will require a terminal window. We can open new terminal by 3 ways.
1. We can use shortcut , Ctrl+’
2. Or, Click on Terminal and choose New Terminal
3. Or, Right click on project & choose Open in Terminal
Check Current NodeJS Version
Now we are good to go, lets check the current version of NodeJS in your DEV SPACE on Business Application Studio.
Command : node -v
We can see , the version installed is 10.23.1, its the default version that comes on BAS.
Check Current NPM Version
Lets check the current version of NPM in your DEV SPACE on Business Application Studio.
Command : npm -v
We can see , the version installed is 6.14.10, its the default version that comes on BAS.
Update NPM on Business Application Studio
Lets update the NPM first. Use the below command.
Command : npm update
Now lets check the updated version
We can see NPM has been updated from 6.14.10 to 7.5.1
Update NodeJS on Business Application Studio
To update NodeJS we require NVM. NVM stands for Node.js Version Manager, its required if you want to check available NodeJS versions, can switch them or install new version.
Step 1 : Try NVM
Try the below command to get available NodeJS versions.
Command : nvm list
You will see the above error as nvm is not present by default.
Step 2 : Install NVM
So, lets install nvm first, use the below command to do the same.
Command : curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash
Now, reopen the terminal to reflect the latest changes. Once reopened , use the below command.
Command : npm config delete prefix
Step 3 : Check available NodeJS Versions
Lets try nvm to get list of all available NodeJS versions(Already installed on the Space).
Command : nvm list
Step 4 : Update NodeJS version
There are two ways of doing it :
- Change NodeJS version from existing ones (already installed)
- Install a new version of NodeJS
1. Change Version from Existing
We can do this using the below command.
Command : node use <version>
We currently have 10.23.1, lets use another installed version for the space.
We confirm the same use using node -v
Now Space is using v12.20.1 as the default version.
2. Install New Version
Second option is to install a new version and use the same. We can do this in two ways :
- Install any specific version
- Install latest version
Lets see both the options one by one.
Option 1 : Install any Specific Version
We can use the below command to install any specific version.
Command : nvm install <version>
I am installing v14.0.0 here.
Lets verify the installation.
Version 14 is up & running now for the DEV Space.
Option 2 : Install Latest Version
We can use the below command to install the latest version of NodeJS.
Command : nvm install node
Lets verify the same.
We can see DEV Space is updated to the latest version of NodeJS.
Congratulations, now you know how to update npm & NodeJS version of your DEV Space on SAP Business Application Studio. We now know how to check node version, update npm version, install nvm (node version manager), change the version of NodeJS from installed packages , install specific version of NodeJS & install latest version of NodeJS on SAP Business Application Studio. Hope it will help those who have started working on SAP Business Application Studio, this blog will help in hassle-free development of your application on the platform & resolve any issue caused by older version of NodeJS.