npm i @types/testing-library__jest-dom -D即可Webpack 5 & Jest - Property 'toBeInTheDocument' does not exist on type 'JestMatchers'箴言:因为这些东西是非常简单的。不要抱怨自己学不会,那是因为你没有足够用心。