【发布时间】:2023-03-17 00:34:01
【问题描述】:
当我在 VMWare Horizon 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