Skip to content

Node 18: string-width 使用 v (unicodeSets) regex flag 导致 SyntaxError #80

@Lellansin

Description

@Lellansin

问题

在 Node 18 上运行项目时,string-width 依赖抛出 SyntaxError:

SyntaxError: Invalid regular expression flags
  at node_modules/string-width/index.js:19

根因

string-width 使用了 v(unicodeSets)regex flag,该语法需要 Node.js >=20。Node 18 不支持。

参见:https://github.com/sindresorhus/string-width

影响

修复方向

  • 降级或替换 string-width 到兼容 Node 18 的版本
  • 或更新 engines.node>=20

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions