This topic describes how to install Serverless Devs and Docker in macOS, Linux, and Windows.
Install Serverless Devs
- Install Serverless Devs by using one of the following methods:
- Use a package manager
- Use npm This method applies to Windows, macOS, and Linux operating systems for which npm is installed. Run the following command to install Serverless Devs:
sudo npm install @serverless-devs/s -g
Note If you use this method to install Serverless Devs, the version of Node.js must be Node.js 10 or later. After Node.js is installed, you can run thenode --version
command to view the version of Node.js. - Use Yarn This method applies to Windows, macOS, and Linux operating systems for which Yarn is installed. Run the following command to install Serverless Devs:
sudo yarn global add @serverless-devs/s
- Use npm This method applies to Windows, macOS, and Linux operating systems for which npm is installed.
- Use a script This method is applicable to macOS and Linux. Run the following command to install Serverless Devs:
After the installation is complete, you must configure the environment variables as prompted. Otherwise, the installation cannot take effect in a timely manner. For more information about the message routing feature, see FAQ.curl -o- -L http://cli.so/install.sh | bash
- Use a package manager
- Run the following command to check whether Serverless Devs is installed:
The following sample code is returned if Serverless Devs is successfully installed.sudo s -v
@serverless-devs/s: 2.0.83, linux-x64, node-v14.17.4
Install Docker
You may want to use the FC component of Serverless Devs to build functions, debug functions on your on-premises machine, or configure interconnection between on-premises and cloud applications by running the s build
, s local
, or s proxied
command. In this case, Docker is required. After Docker is installed, Serverless Devs automatically creates a Docker container and performs debugging when Docker is required.
- Windows
Download Docker by referring to the Docker documentation. If you experience a network problem, you can download Docker for Windows provided by Alibaba Cloud.
- macOS
Download Docker by referring to the Docker documentation. If you experience a network problem, you can download Docker for macOS provided by Alibaba Cloud.
- Linux
Download Docker by referring to the Docker documentation. If you experience a network problem, you can download Docker from Alibaba Cloud. For more information, see Alibaba Cloud image origin of the Docker community edition.
s local
and s proxied
in Serverless Devs, or do not run the s build --use-docker
command to install dependencies or build projects, you do not need to install Docker. FAQ
- How do I upgrade Serverless Devs of an earlier version?
You can run the installation command again to upgrade Serverless Devs. For more information, see Install Serverless Devs.
- If the installation process takes a long time, you can use the following npm source to install Serverless Devs. Example command:
npm --registry=https://registry.npmmirror.com install @serverless-devs/s -g
- If you check the version of Serverless Devs after you upgrade Serverless Devs and find that Serverless Devs is not installed, you can use one of the following methods for troubleshooting based on your business requirements:
- Run the following command to configure environment variables:
export PATH=$HOME/.s/node-v14.19.3-linux-x64/bin:$PATH
Note The version number innode-v14.19.3
in this command is an example only. The version number may vary depending on the operating system. - Open a new terminal.
- Run the following command to configure environment variables:
- After Serverless Devs is installed in Linux or macOS, an error may occur when you run a command provided by Serverless Devs. You can use one of the following methods as required for troubleshooting if the
Command not found
error message is returned:- If you used npm or the installation script to install Serverless Devs, run the following command:
ln -s $(npm root -g)/@serverless-devs/s/bin/s /usr/local/bin/s
- If you used Yarn to install Serverless Devs, run the following command:
ln -s $(yarn global dir)/node_modules/@serverless-devs/s /usr/local/bin/
- If you used npm or the installation script to install Serverless Devs, run the following command: