Serverless CLI v1.26.1+. You can get it by running:
npm i -g serverless
You can install the following example:
$ serverless install --url https://github.com/midwayjs/midway-faas/tree/development/packages/serverless-function-examples/aliyun
$ serverless install --url https://github.com/midwayjs/midway-faas/tree/development/packages/serverless-function-examples/scf
$ cd aliyun
$ cd scf
国内用户建议使用
cnpm
加速npm,npm install -g cnpm --registry=https://registry.npm.taobao.org
Install npm dependencies.
$ npm i
serverless invoke -f index
// debug 需要 node 10.15 +
serverless invoke -f index --debug
option | explain |
---|---|
-f / --function funcName | Specifies the function name to call |
--debug=debugPort? | Enable step debugging and specifies debug port,default port is 9229 |
serverless package
option | explain |
---|---|
--package | Specify the package file(zip) address, e.g. --package=dist |
--npm=npmName | Specify the npm mirror, e.g. --npm=cnpm |
--skipZip | Package result does not generate zip package |
serverless deploy
Support all package
options.
option | explain |
---|---|
--resetConfig | use new account |
阿里云部署首次需要配置 accountId
、accountKey
、accountSecret
相关配置获取,可参照下方图片(可点击跳转):