# 1. Thiết lập môi trường

> **\[MUST] For this tutorial, you must follow the versions specified on the** [**first page**](https://docs.klaytn.foundation/dapp/tutorials/count-dapp#testing-environment) **when you are setting up the environment. Please change the node version to 10.16.0 by using nvm before downloading caver-js.**

## 1) Cài đặt Node.js (npm) <a href="#id-1-install-node-js-npm" id="id-1-install-node-js-npm"></a>

* Tải xuống Node.js (npm) từ trang chính thức: <https://nodejs.org/>
* Cài đặt gói bằng cách nhấp vào tập tin tải xuống.
* Gõ lệnh `$ node --version` trong cửa sổ lệnh để xác minh `node` đã được cài đặt thành công.

  ```
    v10.16.0
  ```

⚠ Tại thời điểm viết, phiên bản LTS mới nhất tương thích với `caver-js` là 10.16.0. Nếu bạn dùng phiên bản Node cao hơn, `caver-js` sẽ không cài đặt được. Hãy cài đặt lại nút hoặc sử dụng [NVM (Trình quản lý phiên bản nút)](https://github.com/nvm-sh/nvm) để thiết lập môi trường ổn định.

## 2) Cài đặt Truffle <a href="#id-2-install-truffle" id="id-2-install-truffle"></a>

Truffle là công cụ tuyệt vời để biên dịch và triển khai các tập tin hợp đồng.

> **Use `nvm` to set the node version to 12.0.0 only if you are using truffle.**

* Gõ lệnh `$ nvm install 12.0.0`
* Gõ lệnh `$ nvm use 12.0.0`
* Gõ `$ sudo npm install -g truffle` vào cửa sổ lệnh của bạn để cài đặt truffle.
* Gõ lệnh `$ truffle --version` trong cửa sổ lệnh để xác minh `truffle` đã được cài đặt thành công.
* (**Triển khai hợp đồng thông minh của bạn bằng truffle**)
* Gõ `$ nvm use 10.16.0` để quay lại nút v10.16.0 sau khi dùng truffle.

⚠ Nếu phiên bản dưới 5, hãy cài đặt truffle phiên bản 5. `$ sudo npm install -g truffle@5`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://archive-vn.docs.klaytn.foundation/content/dapp/tutorials/klaystagram/1.-environment-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
