sindresorhus / ora

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

Added string-width to dependencies #228

Closed ellingtonc closed 1 year ago

ellingtonc commented 1 year ago

Problem

ora@7.0.0 uses the string-width package, but doesn't include it as a dependency or peer-dependency.

Implication

Users that install & import the latest version of ora for the first time will run into the following runtime error if string-width isn't specifically listed as a dependency or required by any other dependencies.

node:internal/modules/cjs/loader:1077
const err = new Error(message);
            ^
Error: Cannot find module 'string-width'
...

This error is caused by Line 7 in node_modules/ora/index.js

import stringWidth from "string-width";

Solution

Add string-width as a dependency or peer-dependency in ora's package.json.

{
  "name": "ora",
  ...
  "dependencies": {
    ...
    "string-width": "^6.1.0"
  }
}

Problem & Solution Tested On

Last Working Version

sindresorhus commented 1 year ago

Thanks :)