- Documentation
Volcano Engine Function as a Service
Development Guide
Code development
Node.js runtime
Installing dependencies
Node.js runtime
Installing dependencies
Installing dependencies
For the Node.js runtime, veFaaS supports two methods for installing dependencies: online installation and packaging the dependencies together with your code for upload. This topic describes these two dependency installation methods.
Online dependency installation (recommended)
Install dependencies online in the veFaaS console.
tip
veFaaS checks the package.json file in the root directory of the code package and attempts to install the dependencies listed in the file.
- If a package-lock.json file exists, dependencies are installed using the npm install command.
- If a yarn.lock file exists, dependencies are installed using yarn install.
- If neither file exists, dependencies are installed using npm install by default.
- Navigate to the Code tab of your target function and configure the dependencies in the package.json file. Note that you need to follow the official syntax specification.
- Click Install dependencies, and the system will start installing the dependencies online.
- All dependencies will be installed into the node_modules directory.
Packaging dependencies with code for upload
Use a dependency manager (npm / yarn / pnpm) to install dependencies locally, and then package them together with your function code for upload.
warning
- When packaging, the function entry file index.js must be in the root directory of the .zip package. If you package the entire folder and upload the .zip package, the function creation will fail because the entry file cannot be found in the root directory after extraction.
- The size of the zip package must not exceed 256 MiB.
- There are differences between runtime environments. You need to ensure that the Node version you are using is compatible with your function runtime version. Run node -v in your local environment to check the Node version.
- Configure the dependencies in the package.json file located in the root directory of your local project, and make sure to follow the official syntax specification. The following is an example:
- In the root directory of your local project, run the following command to install the dependency packages.
- Run the following command to package all files in the root directory into a .zip archive named deployment.zip.
Last updated: 2026.08.19 14:06:05