TS2792 error TS2792: Cannot find module ‘@playwright/test
‘. Did you mean to set the ‘moduleResolution
‘ option to ‘node
‘, or to add aliases to the ‘paths
‘ option?
Broken Code ❌ playwright.config.staging.ts 1 2 3 4 5 6 7 8 9 import { PlaywrightTestConfig } from '@playwright/test' ;const config : PlaywrightTestConfig = { use : { baseURL : 'https://my-staging-environment.com/' , }, };export default config;
tsconfig.json 1 2 3 4 5 { "compilerOptions" : { "moduleResolution" : "classic" } }
Fixed Code ✔️ To fix the problem you have to use "moduleResolution": "node"
in your TS config:
tsconfig.json 1 2 3 4 5 { "compilerOptions" : { "moduleResolution" : "node" } }