Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Running node 18.20.8 and v1.1.152 results in not parsable regex

未关闭
#1,479 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
58/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
领域
cli

调研方向

首先,使用 Node.js 18.20.8 以及 issue 中的 npm install 和 socket --version 命令复现该失败。检查所示正则表达式附近的 dist/vendor.js 和 dist/utils.js,然后验证 socket --version、socket --help 和 socket npm --version 是否能在文档所述的 Node.js 版本上成功启动。

由索引模型根据 Issue 内容生成。

描述

When using node version 18.20.8 upgrading to the release v1.1.152 failed, whereas version v1.1.143 works.

The documentation lists that for running socket, node version 18.20.8 is a minimum but supported requirement.

Steps for reproduction

nvm use 18.20.8
npm install --global socket@1.1.152
socket --version

The problem can also be reproduced directly with the relevant JavaScript syntax:

node -e 'console.log(/[\p{ASCII}&&\p{Letter}]/v)'

On Node.js 18.20.8 this results in:

SyntaxError: Invalid regular expression flags

Actual result

Every Socket command fails during startup, including:

socket --version
socket --help
socket npm --version

The application prints the following trace.

/home/x/.nvm/versions/node/v18.20.8/lib/node_modules/socket/dist/vendor.js:30745
                        */let cachedEastAsianWidth;function getEastAsianWidth(){if(cachedEastAsianWidth===void 0)cachedEastAsianWidth=require_get_east_asian_width().eastAsianWidth;return cachedEastAsianWidth;}let segmenter;function getSegmenter(){if(segmenter===void 0)segmenter=new require_primordials_intl.IntlSegmenter();return segmenter;}let zeroWidthClusterRegex;let leadingNonPrintingRegex;let emojiRegex;try{zeroWidthClusterRegex=/^(?:\p{Control}|\p{Default_Ignorable_Code_Point}|\p{Mark}|\p{Surrogate})+$/v;leadingNonPrintingRegex=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v;emojiRegex=/^\p{RGI_Emoji}$/v;}catch{zeroWidthClusterRegex=/^(?:\p{Control}|\p{Default_Ignorable_Code_Point}|\p{Mark})+$/u;leadingNonPrintingRegex=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}]+/u;emojiRegex=/^\p{Extended_Pictographic}$/u;}/* c8 ignore stop *//**
                                                                                                                                                                                                                                                                                                                                                                                                                                                     ^

SyntaxError: Invalid regular expression flags
    at internalCompileFunction (node:internal/vm:76:18)
    at wrapSafe (node:internal/modules/cjs/loader:1283:20)
    at Module._compile (node:internal/modules/cjs/loader:1328:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/home/x/.nvm/versions/node/v18.20.8/lib/node_modules/socket/dist/utils.js:3:14)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)

Node.js v18.20.8
主要语言
TypeScript
星标
317
派生
65
平均合并
1 小时 26 分钟
30 天内合并 PR
30

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

SocketDev/socket-cli 的其他 Issue

查看 SocketDev/socket-cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。