---
title: "Tạo một node n8n mới"
description: "Thiết lập thư mục và môi trường NodeJS Sử dụng phiên bản nodejs 14.15.5. Bạn có thể cài phiên bản node này nên máy hoặc sử dụng container như mình node -v v14.1"
date: "2022-02-13"
author:
  name: "Nguyen Pham"
  role: "Xin chào. Mình thích lập trình và công nghệ. Đây là blog mình chia sẻ lại các kiến thức về lập trình, công nghệ."
  avatar: "http://0.gravatar.com/avatar/6fb61398e24046b34e13870dd6c357b9?s=128&d=mm&r=g"
category: "Programming"
tags: ["Programming", "n8n", "NodeJS", "typescript"]
coverImage: "/blog/covers/tao-mot-node-n8n-moi.png"
featured: false
readingTime: "2 min read"
---

## Thiết lập thư mục và môi trường

### NodeJS

Sử dụng phiên bản nodejs 14.15.5.

Bạn có thể cài phiên bản node này nên máy hoặc sử dụng container như mình

```
node -v
v14.15.5
```

### n8n install

Cài đặt n8n nên máy để chạy và phát triển các node mới

```
mkdir n8n-install
npm init -y
npm install n8n
```

## Tạo node mới

tạo thư mục mới `n8n-dev`

clone node mẫu về

cài đặt package

build node

link thư mục hiện tại tới global

```
mkdir n8n-dev
git clone <https://github.com/n8n-io/n8n-nodes-starter.git>
npm install
npm run build
npm link
```

💡 Khi tùy biến thì tên package phải bắt đầu bằng `n8n-nodes-`

## Chạy n8n và kiểm tra node mới

liên kết package n8n-nodes-starter

chạy n8n

```
npm link n8n-nodes-starter
./node_modules/n8n/bin/n8n start
```

![](https://2k1.org/wp-content/uploads/2022/02/Untitled-1-1024x576.png)

### Tham khảo

[Creating n8n-nodes-module | n8n Docs](https://docs.n8n.io/nodes/creating-nodes/create-n8n-nodes-module.html#create-custom-n8n-nodes-module)

[npm-link | npm Docs](https://docs.npmjs.com/cli/v8/commands/npm-link)
