nx-plugin/devkit: when using PNPM, runPackageManagerInstall and installPackagesTask do not work in Nx plugin e2e tests on GitHub CI
See original GitHub issueThe Nx 12 roadmap (https://github.com/nrwl/nx/issues/4492) mentions additional efforts to test PNPM-based repos. This seems to be one of those issues worth looking into. Either that, or I’m doing something wrong.
Current Behavior
When using PNPM as the workspace package manager, the following occurs in GitHub CI workflows:
- When calling
runPackageManagerInstall
from@nrwl/nx-plugin/testing
in an end-to-end test,spawnSync
fails withspawnSync /bin/sh ENOENT
. - When calling
installPackagesTask
from@nrwl/devkit
in a generator, end-to-end tests fails withCommand failed: pnpm install
.
End-to-end tests work locally.
Expected Behavior
When using PNPM as the workspace package manager, the following should occurs in GitHub CI workflows:
- Calling
runPackageManagerInstall
from@nrwl/nx-plugin/testing
in an end-to-end test should succeed. - Calling
installPackagesTask
from@nrwl/devkit
in a generator, end-to-end tests should succeed.
Steps to Reproduce
Minimal reproduction in workspace generated using create-nx-plugin
: LayZeeDK/nx-plugin-issue-pnpm-install.
Failure Logs
runPackageManagerInstall
error in end-to-end test:
console.error
Error: spawnSync /bin/sh ENOENT
at Object.spawnSync (internal/child_process.js:1042:20)
at spawnSync (child_process.js:621:24)
at Object.execSync (child_process.js:666:15)
at Object.runPackageManagerInstall (/home/runner/work/nx-plugin-issue-pnpm-install/nx-plugin-issue-pnpm-install/node_modules/.pnpm/@nrwl/nx-plugin@11.1.1_typescript@4.0.5/packages/nx-plugin/src/utils/testing-utils/nx-project.ts:50:19)
at Object.<anonymous> (/home/runner/work/nx-plugin-issue-pnpm-install/nx-plugin-issue-pnpm-install/e2e/pnpm-install-e2e/tests/pnpm-install.spec.ts:15:27)
at /home/runner/work/nx-plugin-issue-pnpm-install/nx-plugin-issue-pnpm-install/node_modules/.pnpm/jest-jasmine2@26.6.3_ts-node@9.1.1/node_modules/jest-jasmine2/build/queueRunner.js:45:12
at new Promise (<anonymous>)
at mapper (/home/runner/work/nx-plugin-issue-pnpm-install/nx-plugin-issue-pnpm-install/node_modules/.pnpm/jest-jasmine2@26.6.3_ts-node@9.1.1/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
at /home/runner/work/nx-plugin-issue-pnpm-install/nx-plugin-issue-pnpm-install/node_modules/.pnpm/jest-jasmine2@26.6.3_ts-node@9.1.1/node_modules/jest-jasmine2/build/queueRunner.js:75:41 {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawnSync /bin/sh',
path: '/bin/sh',
spawnargs: [ '-c', 'pnpm install' ],
error: [Circular],
status: null,
signal: null,
output: null,
pid: 2002,
stdout: null,
stderr: null
}
installPackagesTask
error in end-to-end test:
● pnpm-install e2e › should create pnpm-install
Command failed: pnpx nx generate @nx-plugin/pnpm-install:pnpm-install pnpm-install4931585
Command failed: pnpm install
Environment
GitHub CI report:
> NX Report complete - copy this into the issue template
Node : 12.20.0
OS : linux x64
pnpm : 5.15.0
nx : Not Found
@nrwl/angular : Not Found
@nrwl/cli : 11.1.1
@nrwl/cypress : Not Found
@nrwl/devkit : 11.0.20
@nrwl/eslint-plugin-nx : 11.1.1
@nrwl/express : Not Found
@nrwl/jest : 11.1.1
@nrwl/linter : 11.1.1
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : 11.1.1
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 11.1.1
@nrwl/web : Not Found
@nrwl/workspace : 11.1.1
typescript : 4.0.5
Local report:
> NX Report complete - copy this into the issue template
Node : 12.20.1
OS : win32 x64
pnpm : 5.15.0
nx : Not Found
@nrwl/angular : Not Found
@nrwl/cli : 11.1.1
@nrwl/cypress : Not Found
@nrwl/devkit : 11.0.20
@nrwl/eslint-plugin-nx : 11.1.1
@nrwl/express : Not Found
@nrwl/jest : 11.1.1
@nrwl/linter : 11.1.1
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : 11.1.1
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 11.1.1
@nrwl/web : Not Found
@nrwl/workspace : 11.1.1
typescript : 4.0.5
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Plugin end-to-end tests do not work out-of-the-box #10084
Initialize a new Nx plugins repository. We create a new plugin "my-plugin" with a new monorepo "my-org": PS D:\Development\workspaces ...
Read more >nx-plugin: The e2e executor ignores dependsOn #9260
We have several plugins in our workspace that dependsOn each other. ... That works finde with nx build but doesn't work in the...
Read more >pnpm not working with nx - more explained inside #2944
Hi, I am trying to use pnpm with nx. I have brand new project. I did a pnpm install and it created the...
Read more >Plugin e2e tests bug · Issue #9141 · nrwl/nx
Current Behavior E2e tests fails Expected Behavior E2e tests should work properly Steps to Reproduce npx create-nx-plugin plugin-e2e ...
Read more >nx affected:e2e is hanging on last app running · Issue #8286
Current Behavior Hanging happens it seems to be on the last e2e app that runs Individually the e2e apps work fine when doing...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@LayZeeDK we use circleci but I have tested and GH actions. It turns out that the problem is that
pnpm
by default uses--frozen-lockfile
on CIs and this is causing the failure ifpackage.json
has changed. I will try to send a PR that will fix it in our side.It worked in this branch of my issue repo: