Kong / Kong/httpsnippet

Unable to initialize library

オープン
#307 コメント 2 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
1.2k
フォーク
242
PR マージ指標
30日以内にマージされた PR はありません

説明

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 

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

再現ケースは index.js にあり、依存関係は package.json で httpsnippet ^2.0.0 に固定されています。まず node index.js を実行して、パッケージがエクスポートする値を確認してください。表示された HTTPSnippet の初期化が成功し、要求された curl 出力が生成されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, nodejs
領域
devtools
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。