Skip to content

Node.js

Introduction

Node.js and npm (Node Package Manager) are both prerequisites for Appium, so we need to install them first.
Appium requires:

  • Node.js version >= 18.0.0
  • npm version >= 8

Checking current versions

To check if Node.js is already installed in your system, open your terminal and type:

shell
node --version

To check if npm is already installed in your system, open your terminal and type:

shell
npm --version

If an error message appears for any of the above commands, or if the displayed versions don't match the Appium requirements, then you need to install Node.js and npm.

Installation

Go to the Node.js download official site.
Follow the instructions to download and install the respective LTS version of Node.js for your operating system.
Node installation already install npm as well.
After the installation, close and re-open the terminal and check the current version again.

Troubleshooting

Powershell security exception (npm)

Problem: Launching npm raises this exception:

text
npm : File C:\Program Files\nodejs\npm.ps1 cannot be loaded because running scripts is disabled on this system. 
For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ npm --version
+ ~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

Solution: Open Windows Powershell as Administrator and execute this command:

powershell
Set-ExecutionPolicy Unrestricted -Scope LocalMachine -Force