This topic describes how to install Serverless Devs in macOS, Linux, and Windows.
Install Serverless Devs
- Use a package manager
- Select a package manager as required and use it to install Serverless Devs.
- Use npm: This method applies to Windows, macOS, and Linux operating systems where
npm is installed.
Run the following command to install Serverless Devs:
npm install @serverless-devs/s -g
Note You must use Node.js 10.X 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 where
Yarn is installed.
Run the following command to install Serverless Devs:
yarn global add @serverless-devs/s
- Use npm: This method applies to Windows, macOS, and Linux operating systems where
npm is installed.
- Run the following command to check whether Serverless Devs is installed:
The following code is returned if the installation is successful:s -v
@serverless-devs/s: 2.0.83, linux-x64, node-v14.17.4
- Select a package manager as required and use it to install Serverless Devs.
- Use the installation script (applicable to macOS and Linux)
- Run the following command to install Serverless Devs:
curl -o- -L http://cli.so/install.sh | bash
- Run the following command to check whether Serverless Devs is installed:
The following code is returned if the installation is successful:s -v
@serverless-devs/s: 2.0.83, linux-x64, node-v14.17.4
- Run the following command to install Serverless Devs:
Install Docker (Optional)
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.
- For Windows operating systems
For more information about how to download Docker, visit the official Docker website. If you experience a network problem, you can download Docker for Windows provided by Alibaba Cloud.
- For macOS operating systems
For more information about how to download Docker, visit the official Docker website. If you experience a network problem, you can download Docker for macOS provided by Alibaba Cloud.
- Linux operating systems
For more information about how to download Docker, visit the official Docker website. 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.
FAQ
- How do I upgrade Serverless Devs of an earlier version?
To upgrade Serverless Devs, run the installation command again. For more information, see the Install Serverless Devs section of this topic.
- If the installation process takes a long period, you can run the following command
to use Taobao npm to install Serverless Devs:
npm --registry=https://registry.npm.taobao.org 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 upgraded at the earliest opportunity, you can use
one of the following methods as required for troubleshooting:
- Run the following command to set the PATH environment variable:
export PATH=$HOME/.s/node-v14.17.4-darwin-x64/bin:$PATH
- Open a new terminal.
- Run the following command to set the PATH environment variable:
- You can use one of the following methods as required for troubleshooting if the
Error: EACCES: permission denied
error message is returned when you install Serverless Devs in Linux or macOS:- If you use a package manager to install Serverless Devs, run the following command:
sudo npm install @serverless-devs/s -g
- If you use the installation script to install Serverless Devs, run the following command:
sudo curl -o- -L http://cli.so/install.sh | sudo bash
- If you use a package manager to install Serverless Devs, run the following command:
- 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: