【问题标题】:Create React App unit tests does not execute in VMWare Horizon Client创建 React App 单元测试不会在 VMWare Horizo​​n Client 中执行
【发布时间】:2023-03-17 00:34:01
【问题描述】:

当我在 VMWare Horizo​​n Client(VDI) Windows 机器中使用 create-react-app 创建一个 react 应用程序时,它运行正常,但是在执行 npm run test 时它给了我以下异常

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: UNKNOWN: unknown error, watch
    at FSEvent.FSWatcher._handle.onchange (fs.js:1372:28)
Emitted 'error' event at:
    at NodeWatcher.checkedEmitError (Z:\Workplace\abc\abc-UI\node_modules\sane\src\node_watcher.js:159:10)
    at FSWatcher.emit (events.js:182:13)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1378:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! abc-ui@0.1.0 test: `react-scripts test`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the abc-ui@0.1.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\usr\AppData\Roaming\npm-cache\_logs\2019-01-30T10_53_14_533Z-debug.log

我在我的常规 Windows 机器上做了同样的创建反应应用程序并执行了npm run test,它按预期成功执行。

我试过删除并重新安装node_modules,也启用了轮询,但没有用。

package.json 中的 npm run test 也使用 react-scripts 运行测试我没有对 package.json 中的脚本进行任何更改

我的本​​地机器和 VDI 上的节点和 npm 版本相同

Node version : 10.4.1
npm : 6.1.0

我也有相同版本的 Windows,并且正在使用相同版本的 create-react-app。此问题似乎仅在 VDI 环境中持续存在。我也无法在我的 VDI 上升级或降级 npm/Node 版本。

【问题讨论】:

    标签: reactjs jestjs create-react-app react-scripts


    【解决方案1】:

    事实证明,仅当我们在共享网络驱动器中执行此代码时才会发生此错误。如果我们从本地磁盘(例如 C 驱动器等磁盘存储)运行相同的代码,则测试用例会按预期执行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-09-11
      • 2019-10-18
      • 1970-01-01
      • 1970-01-01
      • 2019-04-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多