进程失败:spawn C:\WINDOWS\system32\cmd.exe ENOENT Jest进程“watch-tests”意外结束,并带有wsl 2和jest扩展名

mspsb9vt  于 2023-05-11  发布在  Jest
关注(0)|答案(2)|浏览(410)

我在wsl 2中运行vscode,扩展名为orta.vscode-jest。当我通过powershell打开vscode时,扩展可以正常工作,但是当我通过wsl 2运行vscode时,我得到以下错误:

我还得到以下错误

not-test onProcessExit: process exit with code=4294963238, signal=undefined
 see troubleshooting: https://github.com/jest-community/vscode-jest/blob/master/README.md#troubleshooting
'\\wsl.localhost\Ubuntu\home\{mypath}\wwwroot'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Windows\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Windows\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Roaming\npm-cache\_logs\2021-09-13T16_50_21_922Z-debug.log
Jest process "watch-tests" ended unexpectedly
 see troubleshooting: https://github.com/jest-community/vscode-jest/blob/master/README.md#troubleshooting

它在一个React应用程序中运行,在package.json中有这些jest设置

"jest": {
    "coverageReporters": [
      "lcov",
      "text"
    ],
    "coveragePathIgnorePatterns": [
      "src/index.tsx",
      "src/locales/"
    ],
    "coverageThreshold": {
      "global": {
        "branches": 84,
        "functions": 85,
        "lines": 85,
        "statements": 85
      }
    }
  }

我可以使用“npm run coverage”从cli运行我的coverage,其中coverage脚本定义如下:

react-scripts test --coverage --resetMocks=false

但我希望手表功能能正常工作。
任何帮助将不胜感激!

wko9yo5t

wko9yo5t1#

我发现问题是我从powershell内部启动了vscode,而我应该在wsl中启动它。
编辑:对不起,从我最初的描述来看有点不清楚。我会尽量详细说明。通常情况下,我会通过在文件浏览器中导航到文件夹并选择“使用代码打开”来打开vscode。我相信我的“用代码打开”没有启动wsl 2示例,即使它在我的wsl路径中。我通过在该目录中打开wsl2并选择“code”来修复它,我确信还有另一种方法,即在powershell中启动一个wsl2示例,但我没有尝试过。

iovurdzv

iovurdzv2#

删除以下文件夹对我有效。使用此应用程序“Sysinternals Autoruns”https://www.bleepingcomputer.com/download/autoruns/查找此应用程序“Dllhost”。在我的PC中,在此路径“C:\ProgramData\Dllhost”中,因此我删除了名为“NvStray”的任务调度程序文件夹,该文件夹指向同一路径“C:\ProgramData\Dllhost”
从那以后,一切都很顺利

相关问题