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

creating new nx workspace with preset=qwik-nx using pnpx throws an error #44

Closed
shairez opened this issue Jan 19, 2023 · 18 comments · Fixed by #76
Closed

creating new nx workspace with preset=qwik-nx using pnpx throws an error #44

shairez opened this issue Jan 19, 2023 · 18 comments · Fixed by #76
Assignees
Labels
bug Something isn't working

Comments

@shairez
Copy link
Contributor

shairez commented Jan 19, 2023

Describe the bug

Creating a new workspace with the qwik-nx preset throws (I'm using windows 10)

To Reproduce

Run pnpx create-nx-workspace --preset qwik-nx

Expected behavior
To complete with no errors

Screenshots

node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: spawn pnpm ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:289:12)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn pnpm',
  path: 'pnpm',
  spawnargs: [
    'exec',
    'nx',
    '--nxWorkspaceRoot="C:/dev/workspace/open-source"',
    'g',
    'qwik-nx:preset',
    '--no-a',
    '--no-g',
    '--$0=C:\\Users\\MyUser\\AppData\\Local\\pnpm\\store\\v3\\tmp\\dlx-19560\\node_modules\\create-nx-workspace\\bin\\index.js',
    '--packageManager=pnpm',
    '--defaultBase=main'
  ]
}

Node.js v18.7.0
 ERROR  Command failed with exit code 1: C:\Users\MyUser\AppData\Local\pnpm\store\v3\tmp\dlx-19560\node_modules\.bin\create-nx-workspace.CMD --preset qwik-nx

pnpm: Command failed with exit code 1: C:\Users\MyUser\AppData\Local\pnpm\store\v3\tmp\dlx-19560\node_modules\.bin\create-nx-workspace.CMD --preset qwik-nx
    at makeError (C:\Users\MyUser\AppData\Roaming\nvm\v18.7.0\node_modules\pnpm\dist\pnpm.cjs:22852:17)
    at handlePromise (C:\Users\MyUser\AppData\Roaming\nvm\v18.7.0\node_modules\pnpm\dist\pnpm.cjs:23423:33)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.handler [as dlx] (C:\Users\MyUser\AppData\Roaming\nvm\v18.7.0\node_modules\pnpm\dist\pnpm.cjs:202440:7)
    at async C:\Users\MyUser\AppData\Roaming\nvm\v18.7.0\node_modules\pnpm\dist\pnpm.cjs:209882:21
    at async main (C:\Users\MyUser\AppData\Roaming\nvm\v18.7.0\node_modules\pnpm\dist\pnpm.cjs:209853:34)
    at async runPnpm (C:\Users\MyUser\AppData\Roaming\nvm\v18.7.0\node_modules\pnpm\dist\pnpm.cjs:210079:5)
    at async C:\Users\MyUser\AppData\Roaming\nvm\v18.7.0\node_modules\pnpm\dist\pnpm.cjs:210071:7

Desktop (please complete the following information):

  • OS: Windows 10
@shairez shairez added the bug Something isn't working label Jan 19, 2023
@dmitry-stepanenko
Copy link
Contributor

For some reason ensurePackage function doesn't add packages when used within create-nx-workspace

@dmitry-stepanenko
Copy link
Contributor

On macOS 10.15.6 it fails with the following

 >  NX   Cannot find module '@nxkit/playwright'

   Require stack:
   - /Users/dmitriy/projects/test/cuterepo/node_modules/qwik-nx/src/generators/application/lib/add-e2e-project.js
   - /Users/dmitriy/projects/test/cuterepo/node_modules/qwik-nx/src/generators/application/generator.js
   - /Users/dmitriy/projects/test/cuterepo/node_modules/qwik-nx/src/generators/preset/generator.js
   - /Users/dmitriy/projects/test/cuterepo/node_modules/nx/src/config/workspaces.js
   - /Users/dmitriy/projects/test/cuterepo/node_modules/nx/src/config/configuration.js
   - /Users/dmitriy/projects/test/cuterepo/node_modules/nx/src/command-line/generate.js
   - /Users/dmitriy/projects/test/cuterepo/node_modules/nx/src/command-line/nx-commands.js
   - /Users/dmitriy/projects/test/cuterepo/node_modules/nx/bin/init-local.js
   - /Users/dmitriy/projects/test/cuterepo/node_modules/nx/bin/nx.js
   Pass --verbose to see the stacktrace.


 >  NX   Failed to apply preset: qwik-nx

@giri-jeedigunta
Copy link
Contributor

On macOS 10.15.6 it fails with the following

 >  NX   Cannot find module '@nxkit/playwright'

   Require stack:
   - /Users/dmitriy/projects/test/cuterepo/node_modules/qwik-nx/src/generators/application/lib/add-e2e-project.js
   - /Users/dmitriy/projects/test/cuterepo/node_modules/qwik-nx/src/generators/application/generator.js
   - /Users/dmitriy/projects/test/cuterepo/node_modules/qwik-nx/src/generators/preset/generator.js
   - /Users/dmitriy/projects/test/cuterepo/node_modules/nx/src/config/workspaces.js
   - /Users/dmitriy/projects/test/cuterepo/node_modules/nx/src/config/configuration.js
   - /Users/dmitriy/projects/test/cuterepo/node_modules/nx/src/command-line/generate.js
   - /Users/dmitriy/projects/test/cuterepo/node_modules/nx/src/command-line/nx-commands.js
   - /Users/dmitriy/projects/test/cuterepo/node_modules/nx/bin/init-local.js
   - /Users/dmitriy/projects/test/cuterepo/node_modules/nx/bin/nx.js
   Pass --verbose to see the stacktrace.


 >  NX   Failed to apply preset: qwik-nx

I'm seeing the same error ... This is what I have

node v16.19.0
[email protected]

@dmitry-stepanenko
Copy link
Contributor

dmitry-stepanenko commented Feb 2, 2023

@giri-jeedigunta as a workaround for now you can use npx create-nx-workspace --preset qwik-nx --e2eTestRunner=none.

@giri-jeedigunta
Copy link
Contributor

@giri-jeedigunta as a workaround for now you can use npx create-nx-workspace --preset qwik-nx --e2eTestRunner=none.

This works !!! I'm able to move forward

@DominikPieper
Copy link

The error appears with just the app generator in a fresh Nx workspace as well. At least for me some minutes ago. So maybe not a preset issue alone

@dmitry-stepanenko
Copy link
Contributor

@DominikPieper can you please provide error logs or reproduction steps (along with versions/environment you are using)? I don't see any issues with app generator as of now

@DominikPieper
Copy link

@dmitry-stepanenko If I call the generator twice, the second call works as expected. I'll take a deeper look later

Steps:

npx create-nx-workspace@latest nx-qwik-test (used the integrated scheme)
npm install --save qwik-nx
npx nx g qwik-nx:app app

Logs:

npx nx g qwik-nx:app app --verbose

>  NX  Generating qwik-nx:application

✔ Which stylesheet format would you like to use? · css
added 1 package, removed 32 packages, and audited 350 packages in 796ms

31 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

 >  NX   Cannot find module '@nxkit/playwright'

   Require stack:
   - /private/tmp/nx-qwik-test/node_modules/qwik-nx/src/generators/e2e-project/generator.js
   - /private/tmp/nx-qwik-test/node_modules/qwik-nx/src/generators/application/generator.js
   - /private/tmp/nx-qwik-test/node_modules/nx/src/config/workspaces.js
   - /private/tmp/nx-qwik-test/node_modules/nx/src/config/configuration.js
   - /private/tmp/nx-qwik-test/node_modules/nx/src/command-line/generate.js
   - /private/tmp/nx-qwik-test/node_modules/nx/src/command-line/nx-commands.js
   - /private/tmp/nx-qwik-test/node_modules/nx/bin/init-local.js
   - /private/tmp/nx-qwik-test/node_modules/nx/bin/nx.js

Error: Cannot find module '@nxkit/playwright'
Require stack:
- /private/tmp/nx-qwik-test/node_modules/qwik-nx/src/generators/e2e-project/generator.js
- /private/tmp/nx-qwik-test/node_modules/qwik-nx/src/generators/application/generator.js
- /private/tmp/nx-qwik-test/node_modules/nx/src/config/workspaces.js
- /private/tmp/nx-qwik-test/node_modules/nx/src/config/configuration.js
- /private/tmp/nx-qwik-test/node_modules/nx/src/command-line/generate.js
- /private/tmp/nx-qwik-test/node_modules/nx/src/command-line/nx-commands.js
- /private/tmp/nx-qwik-test/node_modules/nx/bin/init-local.js
- /private/tmp/nx-qwik-test/node_modules/nx/bin/nx.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
    at Module._load (node:internal/modules/cjs/loader:885:27)
    at Module.require (node:internal/modules/cjs/loader:1105:19)
    at require (/private/tmp/nx-qwik-test/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at /private/tmp/nx-qwik-test/node_modules/qwik-nx/src/generators/e2e-project/generator.js:35:73
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Nx Report:

npx nx report

 >  NX   Report complete - copy this into the issue template

   Node : 18.13.0
   OS   : darwin x64
   npm  : 8.19.3

   nx : 15.6.3
   @nrwl/angular : Not Found
   @nrwl/cypress : Not Found
   @nrwl/detox : Not Found
   @nrwl/devkit : 15.6.3
   @nrwl/esbuild : Not Found
   @nrwl/eslint-plugin-nx : 15.6.3
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : Not Found
   @nrwl/js : 15.6.1
   @nrwl/linter : 15.6.3
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/rollup : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/webpack : Not Found
   @nrwl/workspace : 15.6.3
   @nrwl/vite : 15.6.1
   typescript : 4.8.4
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:
   	 qwik-nx: 0.9.0
   	 @nxkit/playwright: 2.1.0
``

@dmitry-stepanenko
Copy link
Contributor

Thank you, @DominikPieper! Will take a look

@dmitry-stepanenko
Copy link
Contributor

It seems that this is a bug in the nodejs nodejs/node#44663

At this point it makes sense to adjust third-party package instead of creating workarounds here.

@sebastiandg7 can you please take a look at the fix in your repo please nxkit/nxkit#59 🙏

@sebastiandg7
Copy link
Contributor

Thank you! I'm releasing the fix asap. Will it be worth to cover this with e2e tests?

@dmitry-stepanenko
Copy link
Contributor

dmitry-stepanenko commented Feb 11, 2023

Thanks a lot @sebastiandg7 ! Yes, I will cover this with e2e tests for sure

@sebastiandg7
Copy link
Contributor

Just released @nxkit/playwright v2.1.1 with @dmitry-stepanenko's fix (thanks!). Opened #76 updating our dependency.

@dmitry-stepanenko
Copy link
Contributor

Thank you @sebastiandg7 !

@shairez
Copy link
Contributor Author

shairez commented Feb 13, 2023

this still happens to me even when using npx

Tried to break it into manual steps like @DominikPieper suggested but getting this after running:

npx nx g qwik-nx:preset --verbose

image

@DominikPieper
Copy link

DominikPieper commented Feb 13, 2023

@shairez talked to Giora about the e2e tests at Discord, maybe easier to break down this one after we get tests to cover the preset as well. Easier to test with automation deploy and test cycles

@sebastiandg7
Copy link
Contributor

@shairez @dmitry-stepanenko this seems to be a different error breaking the preset generator, but we couldn't get to that point because of the one we just fixed. Seems like the playwright project generator is not getting the name option passed. Will take a look at that. Can we re open this issue?

@dmitry-stepanenko
Copy link
Contributor

dmitry-stepanenko commented Feb 13, 2023

@sebastiandg7 this is now fixed #79. Haven't setup e2e as I know Giora is working on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants