# 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 web 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. Cài đặt lại Node hoặc sử dụng [NVM (Trình quản lý phiên bản Node)](https://github.com/nvm-sh/nvm) để cài đặt 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.

> Sử dụng `nvm` để đặt phiên bản cho nút thành 12.0.0 chỉ khi bạn sử dụng truffle.

* Gõ lệnh `$ nvm install 12.0.0`
* Gõ lệnh `$ nvm use 12.0.0`
* Gõ lệnh `$ sudo npm install -g truffle` trong cửa sổ lệnh để 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õ lệnh `$ nvm use 10.16.0` để quay về nút v10.16.0 sau khi sử dụng truffle.

⚠ Nếu phiên bản thấp hơn 5, 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/count-dapp/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.
