Skip to content

Added string-width to dependencies#228

Merged
sindresorhus merged 1 commit intosindresorhus:mainfrom
ellingtonc:add-string-width-dependency
Aug 1, 2023
Merged

Added string-width to dependencies#228
sindresorhus merged 1 commit intosindresorhus:mainfrom
ellingtonc:add-string-width-dependency

Conversation

@ellingtonc
Copy link
Copy Markdown
Contributor

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

  • Mac OS X Ventura
  • Debian Linux 12 Bookworm
  • Node v18.7.0
  • Node v20.5.0

Last Working Version

  • The previous release (ora@6.3.1) works as expected as it doesn't depend on or import the string-width package.

@sindresorhus sindresorhus merged commit 1dc1ece into sindresorhus:main Aug 1, 2023
@sindresorhus
Copy link
Copy Markdown
Owner

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants