You can use the Node.js framework to write information about runtime environments of functions in Function Compute.
Node.js runtimes
The following table lists the Node.js runtimes that are supported by Function Compute.
Version | Identifier | Operating system | Architecture |
Node.js 20.x (public preview) | nodejs20 | Linux (Debian 10) | x86_64 |
Node.js 18.x (public preview) | nodejs18 | Linux (Debian 10) | x86_64 |
Node.js 16.x | nodejs16 | Linux (Debian 9) | x86_64 |
Node.js 14.x | nodejs14 | Linux (Debian 9) | x86_64 |
Node.js 12.x | nodejs12 | Linux (Debian 9) | x86_64 |
Node.js 10.x | nodejs10 | Linux (Debian 9) | x86_64 |
Node.js 8.x | nodejs8 | Linux (Debian 9) | x86_64 |
Function Compute will soon stop supporting Node.js 4.4 and Node.js 6 according to plans. For more information, see Runtime deprecation policy.
Node.js 18.x and Node.js 20.x are supported in the following regions: China (Hangzhou), China (Shanghai), China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Shenzhen), China (Chengdu), China (Hong Kong), Singapore, Australia (Sydney), Malaysia (Kuala Lumpur), Indonesia (Jakarta), and Japan (Tokyo), UK (London), and US (Virginia).
Specify an ECMAScript module as the handler
ECMAScript modules are supported by Function Compute in Node.js 18 and later. Only CommonJS modules are supported by Function Compute in Node.js 16 and earlier.
You can specify an ECMAScript module in one of the following methods:
Specify
type
asmodule
in thepackage.json
file of a function to specify an ECMAScript module for all.js
files.Use the
.mjs
file name extension to enable the system to treat all.mjs
files as ECMAScript modules and.js
files as CommonJS modules. You can use the.mjs
extension for some files and the.js
extension for other files based on your business requirements..mjs
files are always treated as ECMAScript modules and.js
files are always treated as CommonJS modules.
Built-in modules
In addition to standard modules of Node.js, Function Compute provides commonly used modules for Node.js for your convenient reference. The following table lists the common modules that are provided by Function Compute.
Node.js 20 and Node.js 18
Module | Description | Version |
co | 4.6.0 | |
gm | 1.25.0 | |
ali-oss | 6.19.0 | |
aliyun-sdk | 1.12.10 | |
alicloud/fc2 | 2.6.6 | |
tablestore | 5.4.1 | |
body | 5.1.0 | |
raw-body | 2.5.2 | |
ali-mns | 2.6.8 | |
alicloud/pop-core | 1.7.13 |
Node.js 16
Module | Description | Version |
co | 4.6.0 | |
gm | 1.23.1 | |
ali-oss | 6.17.1 | |
aliyun-sdk | 1.12.5 | |
alicloud/fc2 | 2.6.0 | |
tablestore | 5.2.1 | |
body | 5.1.0 | |
raw-body | 2.5.1 | |
ali-mns | 2.6.8 | |
alicloud/pop-core | 1.7.12 |
Node.js 14
Module | Description | Version |
co | 4.6.0 | |
gm | 1.23.0 | |
ali-oss | 6.6.0 | |
aliyun-sdk | 1.12.3 | |
alicloud/fc2 | 2.2.0 | |
tablestore | 5.0.7 | |
body | 5.1.0 | |
raw-body | 2.4.1 | |
ali-mns | 2.6.8 | |
alicloud/pop-core | 1.7.9 | |
alicloud/fnf | 1.1.0 |
Node.js 12
Module | Description | Version |
co | 4.6.0 | |
gm | 1.23.0 | |
ali-oss | 6.6.0 | |
aliyun-sdk | 1.12.3 | |
alicloud/fc2 | 2.2.0 | |
opencv | 7.0.0 | |
tablestore | 5.0.7 | |
body | 5.1.0 | |
raw-body | 2.4.1 | |
ali-mns | 2.6.8 | |
alicloud/pop-core | 1.7.9 | |
alicloud/fnf | 1.1.0 |
Node.js 10 and Node.js 8
Module | Description | Version |
co | 4.6.0 | |
gm | 1.23.0 | |
ali-oss | 4.10.1 | |
aliyun-sdk | 1.11.0 | |
alicloud/fc2 | 2.1.0 | |
opencv | 6.2.0 | |
tablestore | 4.2.0 | |
body | 5.1.0 | |
raw-body | 2.3.2 | |
ali-mns | 2.6.5 | |
alicloud/fnf | 1.1.0 |