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

Error when running nx dev with pnpm template #24161

Open
1 of 4 tasks
ndt94 opened this issue May 22, 2024 · 0 comments
Open
1 of 4 tasks

Error when running nx dev with pnpm template #24161

ndt94 opened this issue May 22, 2024 · 0 comments
Assignees
Labels
scope: nextjs Issues related to NextJS support for Nx type: bug

Comments

@ndt94
Copy link

ndt94 commented May 22, 2024

Current Behavior

Error when running nx dev appname

Expected Behavior

Run nx dev appname successfully

GitHub Repo

https://github.com/ndt94/pnpm-test

Steps to Reproduce

  1. Create new Nx workspace using npx create-nx-workspace --pm pnpm
  2. Run through the setup cli
Screenshot 2024-05-22 at 13 37 10
  1. Run nx dev pnpm-test (pnpm-test) is my app name

Nx Report

 NX   Report complete - copy this into the issue template

Node   : 18.18.0
OS     : darwin-x64
pnpm   : 8.9.0

nx (global)        : 19.0.5
nx                 : 19.0.5
@nx/js             : 19.0.5
@nx/jest           : 19.0.5
@nx/eslint         : 19.0.5
@nx/workspace      : 19.0.5
@nx/devkit         : 19.0.5
@nx/eslint-plugin  : 19.0.5
@nx/next           : 19.0.5
@nx/playwright     : 19.0.5
typescript         : 5.4.5
---------------------------------------
Registered Plugins:
@nx/next/plugin
@nx/playwright/plugin
@nx/eslint/plugin
@nx/jest/plugin

Failure Logs

Error: Could not create project graph. Please ensure that your workspace is valid.
    at /Users/jessenguyen/Desktop/projects/side_projects/pnpm-test/node_modules/.pnpm/@nx+next@19.0.5_@babel+core@7.24.5_@swc-node+register@1.8.0_@swc+core@1.3.107_@types+node@18._dzowfhb472kmdh6u3raac5lrk4/node_modules/@nx/next/plugins/with-nx.js:81:23
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async combined (/Users/jessenguyen/Desktop/projects/side_projects/pnpm-test/node_modules/.pnpm/@nx+next@19.0.5_@babel+core@7.24.5_@swc-node+register@1.8.0_@swc+core@1.3.107_@types+node@18._dzowfhb472kmdh6u3raac5lrk4/node_modules/@nx/next/src/utils/compose-plugins.js:12:30)
    at async normalizeConfig (/Users/jessenguyen/Desktop/projects/side_projects/pnpm-test/node_modules/.pnpm/next@14.0.4_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1/node_modules/next/dist/server/config-shared.js:151:12)
    at async loadConfig (/Users/jessenguyen/Desktop/projects/side_projects/pnpm-test/node_modules/.pnpm/next@14.0.4_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1/node_modules/next/dist/server/config.js:714:28)
    at async [next.load_config] (/Users/jessenguyen/Desktop/projects/side_projects/pnpm-test/node_modules/.pnpm/next@14.0.4_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1/node_modules/next/dist/server/next.js:178:56)
    at async NextServer.prepare (/Users/jessenguyen/Desktop/projects/side_projects/pnpm-test/node_modules/.pnpm/next@14.0.4_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1/node_modules/next/dist/server/next.js:152:24)
    at async initializeImpl (/Users/jessenguyen/Desktop/projects/side_projects/pnpm-test/node_modules/.pnpm/next@14.0.4_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1/node_modules/next/dist/server/lib/render-server.js:91:5)
    at async initialize (/Users/jessenguyen/Desktop/projects/side_projects/pnpm-test/node_modules/.pnpm/next@14.0.4_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1/node_modules/next/dist/server/lib/router-server.js:107:22)
    at async Server.<anonymous> (/Users/jessenguyen/Desktop/projects/side_projects/pnpm-test/node_modules/.pnpm/next@14.0.4_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1/node_modules/next/dist/server/lib/start-server.js:247:36) {
  [cause]: [Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
    The "@nx/jest/plugin" plugin threw an error while creating nodes from apps/pnpm-test/jest.config.ts:
      ● Validation Error:

        Module @nx/react/plugins/jest in the transform option was not found.
               <rootDir> is: /Users/jessenguyen/Desktop/projects/side_projects/pnpm-test/apps/pnpm-test

        Configuration Documentation:
        https://jestjs.io/docs/configuration
      ] {
    name: 'ProjectGraphError'
  }
}

Package Manager Version

pnpm (8.9.0)

Operating System

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

Additional Information

After my initial investigation, it seems the package @nx/react wasn't installed when running the install command with pnpm npx create-nx-workspace --pm pnpm. Meanwhile, when running the install command with npm npx create-nx-workspace, the package was installed.

Install with npm

Screenshot 2024-05-22 at 13 16 47
Install with pnpm

Screenshot 2024-05-22 at 13 21 20

Temporary workaround: nx add @nx/react

@FrozenPandaz FrozenPandaz added the scope: nextjs Issues related to NextJS support for Nx label May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: nextjs Issues related to NextJS support for Nx type: bug
Projects
None yet
Development

No branches or pull requests

3 participants