簡介
Fun 是一個用於支持 Serverless 應用部署的工具,能幫助您便捷地管理函數計算、API 網關、日誌服務等資源。它通過一個資源配置文件(template.yml),協助您進行開發、構建、部署操作。
安裝
官方指導包含了3種安裝方式, 我這邊使用的是 Ubuntu 18.04, 就直接通過 npm 進行安裝了.
npm install @alicloud/fun -g
常見問題
- 安裝失敗, 提示 “Missing required argument #1”:
- 去 npm/cli @github 上搜了一下, 發現是 npm 版本過低造成的, 先更新一下 node.js 再使用 npm 安裝 fun 就行了.
- 安裝失敗, 提示 “Response timeout while trying to fetch https://registry.npmjs.org/textextensions (over 30000ms)”:
- 使用國內的 npm 源下載:
npm --registry=https://registry.npm.taobao.org install @alicloud/fun -g
- 使用國內的 npm 源下載:
- 安裝失敗, 提示 “npm WARN checkPermissions Missing write access to /usr/lib/node_modules”:
- 使用 root 賬戶進行下載:
sudo npm --registry=https://registry.npm.taobao.org install @alicloud/fun -g
- 使用 root 賬戶進行下載:
測試安裝效果
執行 fun --version
, 查看 fun 的版本即可.
$fun --version
3.6.13
通過 which fun
可以知道 fun 的可執行文件位於 /usr/bin/fun
.
$ which fun
/usr/bin/fun