sindresorhus / ora

Elegant terminal spinner
MIT License
9.08k stars 269 forks source link

After setting the spinner property, an error occurs when the stop method is called #225

Closed soeasyjx closed 1 year ago

soeasyjx commented 1 year ago

Description

When I set the value of spinner to bouncingBar according to the documentation, the returned instance does not have stop methods, and the terminal directly reports ReferenceError: spinner is not defined

version

node: 18.14.1 ora: "^6.3.1"

code fragment

const login = async () => {
  try {
    const { default: ora } = await import("ora");
    const spinner = ora({
        text: "开始进行登录",
       spinner: "bouncingBar"
    }).start();
    // ...........
   // ...........
    spinner.success("success");
  } catch (error) {
    spinner.fail("fail");
    throw error;
  }
}

login()

result

ReferenceError: spinner is not defined