Funcraft is a command-line tool provided by Function Compute. This tool allows you to easily manage the resources of Function Compute, API Gateway, and Log Service. You can use Funcraft to develop, build, and deploy resources based on the resource configuration file template.yml. This topic describes how to install Funcraft.
For more information about how to migrate Function Compute-related resources from Funcraft to Serverless Devs, see Migrate resources from Funcraft to Serverless Devs.
For more information about Serverless Devs, see What is Serverless Devs?.
For more information about how to install Serverless Devs, see Install Serverless Devs.
We apologize for any inconvenience caused.
Step 1: Install Funcraft
You can use one of the following methods to install Funcraft:
- Use Node Package Manager (npm). This method is applicable to Windows, macOS, and Linux
operating systems in which npm is installed.
-
Run the following command to install Funcraft:
npm install @alicloud/fun -g
Note- If the
Error: EACCES: permission denied
error message appears in Linux or macOS after the preceding command is run, run thesudo npm install @alicloud/fun -g
command. - If the installation takes an extended period of time, you can run the
npm --registry=https://registry.npmmirror.com install @alicloud/fun -g
command to use the Taobao npm source.
- If the
-
After the installation is complete, run the following command to view the version information:
fun --version
-
- Download a binary package. This method is applicable to Windows, macOS, and Linux
operating systems. Perform the following steps to install Funcraft:
-
On the Releases page, click the corresponding download link to download the package of the latest version that suits your operating system.
-
After the package is downloaded, decompress the package. Then, you can use Funcraft.
The following content describes how to install Funcraft in different operating systems in detail:
- Windows
- On the Releases page, download the latest released package named fun-*-win.exe.zip, where the asterisk (
*
) indicates the version number such as v3.6.24. - Decompress the fun-v3.6.24-win.exe.zip package to obtain the fun-v3.6.24.win.exe file. Rename the file as fun.exe.
- Add the fun.exe file to the PATH directory such as C:\WINDOWS\System32.
- Open the command terminal and run the
fun.exe --version
command to check whether Funcraft is installed and view the version number.
- On the Releases page, download the latest released package named fun-*-win.exe.zip, where the asterisk (
- Linux
- On the Releases page, view the latest released package. For example, Release 3.6.24 indicates that the version number is v3.6.24.
- Open a terminal such as Bash or Zsh and run the following command to download Funcraft.
Notice If a later version of Funcraft is available, replace
v3.6.24
inhttps://funcraft-release.oss-cn-hangzhou.aliyuncs.com/fun/fun-v3.6.24-linux.zip
with the latest version number.curl -o fun-linux.zip https://funcraft-release.oss-cn-hangzhou.aliyuncs.com/fun/fun-v3.6.24-linux.zip
Expected output:% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 51.2M 100 51.2M 0 0 17.0M 0 0:00:03 0:00:03 --:--:-- 14.3M
- Run the following command to decompress the ZIP package:
unzip fun-linux.zip
Expected output:Archive: fun-linux.zip inflating: fun-v3.6.24-linux
- Run the following command to move the extracted file to the PATH directory.
Notice If a later version of Funcraft is available, replace
v3.6.24
in the command with the latest version number.mv fun-v3.6.24-linux /usr/local/bin/fun
- Run the following command to check whether the latest Funcraft version is installed:
fun --version
Expected output:3.6.24
- macOS
- On the Releases page, view the latest released package. For example, Release 3.6.24 indicates that the version number is v3.6.24.
- Open a terminal such as Bash or Zsh and run the following command to download Funcraft.
Notice If a later version of Funcraft is available, replace
v3.6.24
inhttps://funcraft-release.oss-cn-hangzhou.aliyuncs.com/fun/fun-v3.6.24-macos.zip
with the latest version number.curl -o fun-macos.zip https://funcraft-release.oss-cn-hangzhou.aliyuncs.com/fun/fun-v3.6.24-macos.zip
Expected output:% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 47.8M 100 47.8M 0 0 724k 0 0:01:07 0:01:07 --:--:-- 3727k
- Run the following command to decompress the ZIP package:
unzip fun-macos.zip
Expected output:Archive: fun-macos.zip inflating: fun-v3.6.24-macos
- Run the following command to move the extracted file to the PATH directory.
Notice If a later version of Funcraft is available, replace
v3.6.24
in the command with the latest version number.mv fun-v3.6.24-macos /usr/local/bin/fun
- Run the following command to check whether the latest Funcraft version is installed:
fun --version
Expected output:3.6.24
-
Step 2: (Optional) Install Docker
You must install Docker in the development environment if you want to compile and install dependencies or perform local debugging by using the fun install, fun build, or fun local command of Funcraft.
- Windows
For more information about how to download Docker, visit the official Docker website. If you encounter a network problem, you can download Docker for Windows provided by Alibaba Cloud.
- macOS
For more information about how to download Docker, visit the official Docker website. If you encounter a network problem, you can download Docker for macOS provided by Alibaba Cloud.
- Linux
For more information about how to download Docker, visit the official Docker website. If you encounter a network problem, you can download Docker from the Alibaba Cloud image origin of the Docker community edition.
For more information about how to download other editions of Docker, visit Docker Hub.