Serverless is a Node.js CLI tool so the first thing you need to do is to install Node.js on your machine.
Note: Serverless runs on Node v4 or higher.
You can verify that Node.js is installed successfully by running
node --version in your terminal. You should see the corresponding Node version number printed out.
Next, install the Serverless Framework via npm which was already installed when you installed Node.js.
Open up a terminal and type
npm install -g serverless to install Serverless.
npm install -g serverless
Once the installation process is done you can verify that Serverless is installed successfully by running the following command in your terminal:
To see which version of serverless you have installed run:
Now we need to install the provider plugin to allow the framework to deploy services to the platform. This plugin is also published on npm and can installed as a project dependency using the
npm install --save-dev command.
npm install serverless-openwhisk --save-dev
Project templates already have this dependency listed in the
package.json file allowing you to just
npm install in the service directory.
serverless-openwhisk plugin must be saved as a
devDependency in the project's
package.json to ensure it is not bundled in the deployment package.
To run serverless commands that interface with the OpenWhisk platform, you will need to setup your OpenWhisk account credentials on your machine.