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

ensurePackage doesn't work in pnpm workspaces #16154

Closed
dmitry-stepanenko opened this issue Apr 6, 2023 · 3 comments
Closed

ensurePackage doesn't work in pnpm workspaces #16154

dmitry-stepanenko opened this issue Apr 6, 2023 · 3 comments

Comments

@dmitry-stepanenko
Copy link
Contributor

Current Behavior

execSync(`${getPackageManagerCommand().addDev} ${pkg}@${requiredVersion}`, {
cwd: tempDir,
stdio: 'ignore',
});

ensurePackage runs getPackageManagerCommand().addDev command in a temp cwd. If the target workspace is pnpm workspace, the command will be pnpm add -Dw. In a temp workspace this throws an error, because the temp workspace is not a pnpm workspace.

Expected Behavior

It should not use -Dw flag for the installation.

GitHub Repo

https://github.com/qwikifiers/qwik-ui

Steps to Reproduce

  1. Checkout the repo, run pnpm install
  2. Run pnpm exec nx g qwik-nx:app myapp --e2eTestRunner=playwright --style=css --verbose. Playwright is not added as a dependency, so qwik-nx will attempt to install it
  3. Notice the error

Nx Report

Node : 18.13.0
   OS   : darwin x64
   pnpm : 7.25.0
   
   nx                      : 15.8.7
   @nrwl/js                : 15.8.7
   @nrwl/linter            : 15.8.7
   @nrwl/workspace         : 15.8.7
   @nrwl/cli               : 15.8.7
   @nrwl/cypress           : 15.8.7
   @nrwl/eslint-plugin-nx  : 15.8.7
   @nrwl/storybook         : 15.8.7
   @nrwl/vite              : 15.8.7
   @nrwl/nx-cloud          : 15.3.1
   typescript              : 5.0.2
   ---------------------------------------
   Community plugins:
   @jscutlery/semver : 2.30.1
   ngx-deploy-npm    : 5.2.0
   qwik-nx           : 0.14.0

Failure Logs

qwik-ui git:(main) ✗ pnpm exec nx g qwik-nx:app myapp --style=css --verbose

>  NX  Generating qwik-nx:application

 ERROR  --workspace-root may only be used inside a workspace

 >  NX   Command failed: pnpm add -Dw @nxkit/playwright@^2.1.2


Error: Command failed: pnpm add -Dw @nxkit/playwright@^2.1.2
    at checkExecSyncError (node:child_process:885:11)
    at execSync (node:child_process:957:15)
    at ensurePackage (/Users/dmitriy/projects/qwik-ui/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@nrwl/devkit/src/utils/package-json.js:260:34)

Additional Information

No response

@leosvelperez
Copy link
Member

This was fixed in #16002. Please keep an eye on the releases to get the fix.

@dmitry-stepanenko
Copy link
Contributor Author

Great, thanks!

@github-actions
Copy link

github-actions bot commented May 7, 2023

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 May 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants