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

`npm run test` does not work on Windows cmd

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

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
shell, typescript
领域
cli

调研方向

从 ionic start 生成的默认测试脚本开始,并比较 Windows cmd 如何解析其中的 react-scripts 参数。在 Windows 上使用 npm run test 重现该失败,然后验证修正后的默认脚本可以成功运行,不会出现此处所示的 command 或 EPIPE 错误。

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

描述

triage

Description:

Default script of npm run test does not work on Windows cmd.

"test": "react-scripts test --transformIgnorePatterns 'node_modules/blahblah...'"

I think the reason is that Windows cmd can't handle single quoted arguments.
The script works when I replace the single quotes with the double quotes.

"test": "react-scripts test --transformIgnorePatterns \"node_modules/blahblah...\""

Steps to Reproduce:

  • Create a project using ionic start
  • Run npm run test

Output:

> cmdtest@0.0.1 test
> react-scripts test --transformIgnorePatterns 'node_modules/(?!(@ionic/react|@ionic/react-router|@ionic/core|@stencil/core|ionicons)/)'

'stencil'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는 배치 파일이 아닙니다.
(=> This sentence means 'stencil' is not a command or an executable)
[ERROR] Unable to find command: /core
[ERROR] Unable to find command: /react-router
node:events:498
      throw er; // Unhandled 'error' event
      ^

Error: EPIPE: broken pipe, write
...

My ionic info:

Ionic:

   Ionic CLI       : 6.20.1 (C:\Users\mathe\AppData\Roaming\npm\node_modules\@ionic\cli)
   Ionic Framework : @ionic/react 6.1.13

Capacitor:

   Capacitor CLI      : 3.6.0
   @capacitor/android : not installed
   @capacitor/core    : 3.6.0
   @capacitor/ios     : not installed

Utility:

   cordova-res : not installed globally
   native-run  : 1.6.0

System:

   NodeJS : v16.14.0 (C:\Program Files\nodejs\node.exe)
   npm    : 8.3.1
   OS     : Windows 10

Other Information:

None

主要语言
TypeScript
星标
2k
派生
681
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

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

ionic-team/ionic-cli 的其他 Issue

查看 ionic-team/ionic-cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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