Unable to initialize library
Đang mở
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- TypeScript
- Star
- 1.2k
- Fork
- 242
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
The library is not getting instantiated, Created a basic node project and trying to instantiate the library. Does not work.
index.js
const HTTPSnippet = require('httpsnippet').HTTPSnippet
const snippet = new HTTPSnippet({
method: 'GET',
url: 'http://mockbin.com/request',
});
const options = { indent: '\t' };
const output = snippet.convert('shell', 'curl', options);
console.log(output);
Package JSON
{
"name": "http-code-generator",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"httpsnippet": "^2.0.0"
}
}
Getting this below error
const snippet = new HTTPSnippet({
^
TypeError: HTTPSnippet is not a constructor
at Object.<anonymous> (/Users/cpandit/WebstormProjects/untitled1/index.js:6:17)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
➜ untitled1
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bản tái hiện nằm trong index.js, với dependency được ghim trong package.json ở httpsnippet ^2.0.0. Trước tiên, hãy chạy node index.js và kiểm tra giá trị được package export; được xem là hoàn tất khi quá trình khởi tạo HTTPSnippet được hiển thị thành công và tạo ra đầu ra curl được yêu cầu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, nodejs
- Lĩnh vực
- devtools
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 45/100