nx: Nx postinstall script fails in Github Actions if repo has nx/playwright
Current Behavior
Cannot install package sin Github Actions, so applications can’t build or deploy.
Expected Behavior
That pnpm install installs packages and postinstall scripts run without failure.
GitHub Repo
supernaut/nx18-next-playwright
Steps to Reproduce
- Add playwright to a Nx 18 repo.
- Push to Github with an action installning npm packages.
Nx Report
Node : 20.11.0
OS : darwin-arm64
pnpm : 8.15.2
nx : 18.0.4
@nx/js : 18.0.4
@nx/jest : 18.0.4
@nx/linter : 18.0.4
@nx/eslint : 18.0.4
@nx/workspace : 18.0.4
@nx/cypress : 18.0.4
@nx/devkit : 18.0.4
@nx/esbuild : 18.0.4
@nx/eslint-plugin : 18.0.4
@nx/next : 18.0.4
@nx/node : 18.0.4
@nx/playwright : 18.0.4
@nx/plugin : 18.0.4
@nx/react : 18.0.4
@nx/storybook : 18.0.4
@nrwl/tao : 18.0.4
@nx/vite : 18.0.4
@nx/web : 18.0.4
@nx/webpack : 18.0.4
typescript : 5.3.3
---------------------------------------
Community plugins:
nx-stylelint : 17.1.4
Failure Logs
.../node_modules/nx postinstall: Unable to create nodes for pnpm-lock.yaml using plugin nx/js/dependencies-and-lockfile.
.../node_modules/nx postinstall: Inner Error: Error: Could not find ".modules.yaml" at "/home/runner/work/project/project/node_modules/.modules.yaml"
.../node_modules/nx postinstall: at loadPnpmHoistedDepsDefinition (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/plugins/js/lock-file/utils/pnpm-normalizer.js:23:15)
.../node_modules/nx postinstall: at getNodes (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/plugins/js/lock-file/pnpm-parser.js:69:77)
.../node_modules/nx postinstall: at getPnpmLockfileNodes (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/plugins/js/lock-file/pnpm-parser.js:27:12)
.../node_modules/nx postinstall: at getLockFileNodes (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/plugins/js/lock-file/lock-file.js:36:59)
.../node_modules/nx postinstall: at exports.createNodes (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/plugins/js/index.js:42:64)
.../node_modules/nx postinstall: at buildProjectsConfigurationsFromProjectPathsAndPlugins (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/utils/project-configuration-utils.js:148:29)
.../node_modules/nx postinstall: at createProjectConfigurations (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:89:156)
.../node_modules/nx postinstall: at _retrieveProjectConfigurations (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:61:12)
.../node_modules/nx postinstall: at retrieveProjectConfigurations (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:46:12)
.../node_modules/nx postinstall: at async buildProjectGraphAndSourceMapsWithoutDaemon (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/project-graph.js:71:69)
.../node_modules/nx postinstall: Unable to create nodes for apps/next-app/playwright.config.ts using plugin @nx/playwright/plugin.
.../node_modules/nx postinstall: Inner Error: Error: ENOENT: no such file or directory, scandir 'apps/next-app'
.../node_modules/nx postinstall: at readdirSync (node:fs:1515:26)
.../node_modules/nx postinstall: at exports.createNodes (/home/runner/work/project/project/node_modules/.pnpm/@nx+playwright@18.0.4_@playwright+test@1.41.2_@swc-node+register@1.8.0_@swc+core@1.3.107_@typ_3om4g7g466ngcx6j4dyl6hei2y/node_modules/@nx/playwright/src/plugins/plugin.js:33:51)
.../node_modules/nx postinstall: at buildProjectsConfigurationsFromProjectPathsAndPlugins (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/utils/project-configuration-utils.js:148:29)
.../node_modules/nx postinstall: at createProjectConfigurations (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:89:156)
.../node_modules/nx postinstall: at _retrieveProjectConfigurations (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:61:12)
.../node_modules/nx postinstall: at retrieveProjectConfigurations (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:46:12)
.../node_modules/nx postinstall: at async buildProjectGraphAndSourceMapsWithoutDaemon (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/project-graph.js:71:69)
.../node_modules/nx postinstall: /home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/utils/project-configuration-utils.js:156
.../node_modules/nx postinstall: throw new CreateNodesError(`Unable to create nodes for ${file} using plugin ${plugin.name}.`, e);
.../node_modules/nx postinstall: ^
.../node_modules/nx postinstall: CreateNodesError: Unable to create nodes for apps/next-app/playwright.config.ts using plugin @nx/playwright/plugin.
.../node_modules/nx postinstall: Inner Error: Error: ENOENT: no such file or directory, scandir 'apps/next-app'
.../node_modules/nx postinstall: at readdirSync (node:fs:1515:26)
.../node_modules/nx postinstall: at exports.createNodes (/home/runner/work/project/project/node_modules/.pnpm/@nx+playwright@18.0.4_@playwright+test@1.41.2_@swc-node+register@1.8.0_@swc+core@1.3.107_@typ_3om4g7g466ngcx6j4dyl6hei2y/node_modules/@nx/playwright/src/plugins/plugin.js:33:51)
.../node_modules/nx postinstall: at buildProjectsConfigurationsFromProjectPathsAndPlugins (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/utils/project-configuration-utils.js:148:29)
.../node_modules/nx postinstall: at createProjectConfigurations (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:89:156)
.../node_modules/nx postinstall: at _retrieveProjectConfigurations (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:61:12)
.../node_modules/nx postinstall: at retrieveProjectConfigurations (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:46:12)
.../node_modules/nx postinstall: at async buildProjectGraphAndSourceMapsWithoutDaemon (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/project-graph.js:71:69)
.../node_modules/nx postinstall: at /home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/utils/project-configuration-utils.js:156:35
.../node_modules/nx postinstall: at async Promise.all (index 0) {
.../node_modules/nx postinstall: [cause]: Error: ENOENT: no such file or directory, scandir 'apps/next-app'
.../node_modules/nx postinstall: at readdirSync (node:fs:1515:26)
.../node_modules/nx postinstall: at exports.createNodes (/home/runner/work/project/project/node_modules/.pnpm/@nx+playwright@18.0.4_@playwright+test@1.41.2_@swc-node+register@1.8.0_@swc+core@1.3.107_@typ_3om4g7g466ngcx6j4dyl6hei2y/node_modules/@nx/playwright/src/plugins/plugin.js:33:51)
.../node_modules/nx postinstall: at buildProjectsConfigurationsFromProjectPathsAndPlugins (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/utils/project-configuration-utils.js:148:29)
.../node_modules/nx postinstall: at createProjectConfigurations (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:89:156)
.../node_modules/nx postinstall: at _retrieveProjectConfigurations (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:61:12)
.../node_modules/nx postinstall: at retrieveProjectConfigurations (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:46:12)
.../node_modules/nx postinstall: at async buildProjectGraphAndSourceMapsWithoutDaemon (/home/runner/work/project/project/node_modules/.pnpm/nx@18.0.4_@swc-node+register@1.8.0_@swc+core@1.3.107/node_modules/nx/src/project-graph/project-graph.js:71:69) {
.../node_modules/nx postinstall: errno: -2,
.../node_modules/nx postinstall: code: 'ENOENT',
.../node_modules/nx postinstall: syscall: 'scandir',
.../node_modules/nx postinstall: path: 'apps/next-app'
.../node_modules/nx postinstall: }
.../node_modules/nx postinstall: }
.../node_modules/nx postinstall: Node.js v20.11.0
.../node_modules/nx postinstall: Failed
ELIFECYCLE Command failed with exit code 1.
Error: Process completed with exit code 1.
Package Manager Version
pnpm 8.15.1
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
Nx report is run on my local machine, so it’s entirely correct. It works locally, but not in Github Actions running on ubuntu-latest. Will set up a repo to reproduce ASAP, but this is a critical showstopper.
About this issue
- Original URL
- State: open
- Created 5 months ago
- Reactions: 13
- Comments: 26
I seem to encounter the same error, besides that I fail to attribute the error to adding the testing library because I had Playwright bundled in the scaffolding process. Thanks for pointing that out.
Nx 18.0.5 seems to have fixed the issue in our production repository, but not in my test repo strangely enough. https://github.com/supernaut/nx18-next-playwright/actions/runs/8037651724/job/21952716499
I am using Gitlab CI and I am seeing the same behaviour. It’s quite a major issue for us because the entire point we want to use the plugin is for automatic E2E task splitting in CI environments.
I have the same issue in Vercel deployment running nx 18.0.8 but without playwright in my repo (installed cypress but still not used it). Localy it passes through this step normally
same here. we have anagular monorepo (latest version - 1) run
EDIT:
After a few trial and errors my fully workaround solution with playwright (to run both on local system and CI) is as follows:
I updated to 18.0.5 but the install still breaks
Added repository that reproduces the issue. Direct link to failing run: https://github.com/supernaut/nx18-next-playwright/actions/runs/7917010202/job/21612157572
I was having this same error
Unable to create nodes for pnpm-lock.yaml using plugin nx/js/dependencies-and-lockfile.among other errors similar to @srslafazan errors above, even after upgrading to nx@18.0.5.I was able to get pass the error using
--ignore-scriptswith pnpm install as suggested by @JoelDigbeu . I still believe this is a workaround since it just ignores running the pre-install and post-install scripts.