Serverless Configuration on new machine
Follow these steps to avoid pain
The pain of installing Serverless
I've always run into permissions/dependency issues when installing serverless on a new machine. First, it needs node
installed, which I'm not the least bit familiar with. Then it needs npm
which is a package manager. So far, okay.
But the serverless documentation for installing it is not super useful, IMHO, for it's not super clear about what to do if you simply can't find your serverless
command or fail to install it despite following the tutorial.
Do this instead
( Thanks to this answer on SO: https://stackoverflow.com/a/66166866/5486022 )
-
Step 1: Install Node
-
Go to https://nodejs.org/en/ and download the node installer for you system (I use Linux)
-
$ sudo apt update
-
$ sudo apt install xz-utils
-
$ sudo tar -xvf name_of_file (let it be
node-v14.15.5-linux-x64
) -
$ sudo cp -r node-v14.15.5-linux-x64/{bin,include,lib,share} /usr/
-
$ node --version
-
You should now have node installed on your system
-
Step 2: Install Serverless as a project dependency (avoid global install
npm install -g serverless
)( Thanks to this answer on SO: https://stackoverflow.com/a/68069795/5486022 )
-
$ npm i -D serverless (At your serverless project root)
-
$ npx sls --version
-
$ npx serverless deploy OR npx sls deploy
-
You should now have Serverless installed for your project