Skip to Content
Technical Articles
Author's profile photo Kapil Verma

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

  1. SAP Fiori
  2. SAP Cloud Business Application
  3. SAP HANA Native Application
  4. SAP Mobile Application
  5. Basic

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 :

  1. Change NodeJS version from existing ones (already installed)
  2. 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.

I have use v12.20.1 from existing installations.

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 :

  1. Install any specific version
  2. 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.

Conclusion

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.

 

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Tim Anlauf
      Tim Anlauf

      Thanks for sharing this information.

       

      npm update

      is not finding generator-fiori-module in the official npmjs repository and ending in a 404

       

      404 Not Found - GET https://registry.npmjs.org/generator-fiori-module - Not found

      Author's profile photo Thomas Jung
      Thomas Jung

      I spoke with a developer for the SAP Business Application Studio team and they agreed that it is NOT advisable to change the Node version of your Dev Space as described here. It can have adverse side effects as this is fundamental to the operation of the Dev Space.

      On a related note the team is currently working on updating the Node.js version 14.x centrally.

      Author's profile photo Ivan Mirisola
      Ivan Mirisola

      Hi Kapil Verma,

      I believe this "procedure" should be done with caution since you are modifying the whole BAS system.

      Furthermore, the procedure doesn't really work as stated. Npm package never updates by issuing the "update" command. In my case I had to use:

      npm -g install npm@7.6.3

      Once it updated it, then I was able to install nvm and switch it to v12. After I changed the Node version to 12, I had to update npm again.

      Best regards,
      Ivan

       

      Author's profile photo Francisco Angulo
      Francisco Angulo

      Hi,

      it doesn't work for me

      $ npm -g install npm@9.1.3
      npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
      
      changed 15 packages in 3s
      
      14 packages are looking for funding
        run `npm fund` for details

      then when I try to check the version

      $ npm -v
      8.11.0

      Do you know how to update npm currently?

       

      EDIT: 

      I have followed the instructions 

      https://answers.sap.com/questions/13151621/update-nodejs-in-sap-business-application-studio.html

      and then:

      $ nvm install --latest-npm

      now the update was done:

      $ npm -v
      9.1.3