Install OSS SDK for Node.js

Updated at: 2024-11-28 02:27

This topic describes how to install OSS SDK for Node.js for uploading, downloading, storing, and managing files in a Node.js application.

Prerequisites

  • Environment requirements

    • We recommend that you use Node.js 8.0 or later.

    • For more information about how to download and install Node.js, see Install Node.js.

  • Check the version of Node.js.

    • Execute the following command to check the version of Node.js.

      node -v
    • Execute the following command to check the version of npm (Node Package Manager).

      npm -v

Install OSS SDK for Node.js

  • Select the SDK version

    • If you are using Node.js 8.0 or later, we recommend that you install the latest SDK 6.x.

    • If the version of Node.js you are using is earlier than 8.0, we recommend that you install SDK 4.x.

  • Execute the following command to install the SDK.

    • Install SDK 6.x

      npm install ali-oss@^6.x --save
    • Install SDK 4.x

      npm install ali-oss@^4.x --save

Verify whether OSS SDK for Node.js is installed

Execute the following command to check whether ali-oss is installed and view its version information.

npm list ali-oss

The following response indicates that ali-oss is installed.

your-project-name@ /path/to/your/project
└── ali-oss@6.x.x

What to do next

After you install OSS SDK for Node.js, you need to configure access credentials. For more information, see Configure access credentials.

  • On this page (1)
  • Prerequisites
  • Install OSS SDK for Node.js
  • Verify whether OSS SDK for Node.js is installed
  • What to do next
Feedback
phone Contact Us

Chat now with Alibaba Cloud Customer Service to assist you in finding the right products and services to meet your needs.

alicare alicarealicarealicare