Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use @nx/playwright due to TypeScript compilation error #22034

Closed
1 of 4 tasks
aramfe opened this issue Feb 28, 2024 · 5 comments · Fixed by #22258
Closed
1 of 4 tasks

Unable to use @nx/playwright due to TypeScript compilation error #22034

aramfe opened this issue Feb 28, 2024 · 5 comments · Fixed by #22258
Assignees
Labels
outdated scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug

Comments

@aramfe
Copy link

aramfe commented Feb 28, 2024

Current Behavior

I am encountering an issue when attempting to use @nx/playwright in my project. The error occurs during the execution of the following command: yarn nx add @nx/playwright

Command failed: yarn nx g @nx/playwright:init --keepExistingVersions --updatePackageScripts
NX  Falling back to ts-node for local typescript execution. This may be a little slower.
 - To fix this, ensure @swc-node/register and @swc/core have been installed
Unable to create nodes for application-tests/sde/playwright.config.ts using plugin @nx/playwright/plugin.

Inner Error: TSError: ⨯ Unable to compile TypeScript:
error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.

Environment:

  • Node version: 20
  • Playwright version: 1.38.1

Expected Behavior

Expected behaviour is that the targets get set up accordingly to the generator.

GitHub Repo

No response

Steps to Reproduce

  1. Run the following command:
    yarn nx add @nx/playwright

Nx Report

NX  Falling back to ts-node for local typescript execution. This may be a little slower.
- To fix this, ensure @swc-node/register and @swc/core have been installed
Unable to create nodes for application-tests/sde/playwright.config.ts using plugin @nx/playwright/plugin. 

       Inner Error: TSError: ⨯ Unable to compile TypeScript:
error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.

  at createTSError (/Users/myuser/project/node_modules/ts-node/src/index.ts:859:12)
  at reportTSError (/Users/myuser/project/node_modules/ts-node/src/index.ts:863:19)
  at /Users/myuser/project/node_modules/ts-node/src/index.ts:1379:34
  at Object.compile (/Users/myuser/project/node_modules/ts-node/src/index.ts:1458:13)
  at Module.m._compile (/Users/myuser/project/node_modules/ts-node/src/index.ts:1617:30)
  at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
  at Object.require.extensions.<computed> [as .ts] (/Users/myuser/project/node_modules/ts-node/src/index.ts:1621:12)
  at Module.load (node:internal/modules/cjs/loader:1207:32)
  at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
  at Module.require (node:internal/modules/cjs/loader:1235:19)
  at Module.Mod.require (/Users/myuser/project/node_modules/nx/bin/init-local.js:145:36)
  at require (node:internal/modules/helpers:176:18)
  at load (/Users/myuser/project/node_modules/@nx/devkit/src/utils/config-utils.js:65:16)
  at loadConfigFile (/Users/myuser/project/node_modules/@nx/devkit/src/utils/config-utils.js:20:36)
  at buildPlaywrightTargets (/Users/myuser/project/node_modules/@nx/playwright/src/plugins/plugin.js:60:70)
  at exports.createNodes (/Users/myuser/project/node_modules/@nx/playwright/src/plugins/plugin.js:43:20)

NX   Unable to create nodes for application-tests/project/playwright.config.ts using plugin @nx/playwright/plugin. 


       Inner Error: TSError: ⨯ Unable to compile TypeScript:
error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.

  at createTSError (/Users/myuser/project/node_modules/ts-node/src/index.ts:859:12)
  at reportTSError (/Users/myuser/project/node_modules/ts-node/src/index.ts:863:19)
  at /Users/myuser/project/node_modules/ts-node/src/index.ts:1379:34
  at Object.compile (/Users/myuser/project/node_modules/ts-node/src/index.ts:1458:13)
  at Module.m._compile (/Users/myuser/project/node_modules/ts-node/src/index.ts:1617:30)
  at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
  at Object.require.extensions.<computed> [as .ts] (/Users/myuser/project/node_modules/ts-node/src/index.ts:1621:12)
  at Module.load (node:internal/modules/cjs/loader:1207:32)
  at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
  at Module.require (node:internal/modules/cjs/loader:1235:19)
  at Module.Mod.require (/Users/myuser/project/node_modules/nx/bin/init-local.js:145:36)
  at require (node:internal/modules/helpers:176:18)
  at load (/Users/myuser/project/node_modules/@nx/devkit/src/utils/config-utils.js:65:16)
  at loadConfigFile (/Users/myuser/project/node_modules/@nx/devkit/src/utils/config-utils.js:20:36)
  at buildPlaywrightTargets (/Users/myuser/project/node_modules/@nx/playwright/src/plugins/plugin.js:60:70)
  at exports.createNodes (/Users/myuser/project/node_modules/@nx/playwright/src/plugins/plugin.js:43:20)

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@AgentEnder
Copy link
Member

This was fixed by #21979. Can you check latest betas or canary release? It should be included in next patch or minor.

@aramfe
Copy link
Author

aramfe commented Mar 6, 2024

@AgentEnder

I sadly still get this very error with the latest 18.1.0-canary.20240306-cc2f655

So it's sadly not fixed for me. I can also confirm that with deleting my playwright.config.ts or renaming ot to something like temp.ts, the command yarn nx add @nx/playwright works without any problem.

Would appreciate further help here.

@aramfe
Copy link
Author

aramfe commented Mar 8, 2024

@AgentEnder could you re-open the issue? Didn't seem like as if your fix fixed my issue or do I need to create another issue?

@AgentEnder AgentEnder added the scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx label Mar 8, 2024
@AgentEnder AgentEnder reopened this Mar 8, 2024
@leosvelperez
Copy link
Member

@aramfe which version of TypeScript are you using?

Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug
Projects
None yet
3 participants