nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
22.39k stars 2.23k forks source link

`ProjectsWithNoNameError` error after updating to v19 #23522

Open knoefel opened 2 weeks ago

knoefel commented 2 weeks ago

Current Behavior

After making a build for a Next.js app inside a dockerfile and then afterwards running a command to generate a siemap via next-sitemap i get the following error ProjectsWithNoNameError: The projects in the following directories have no name provided:.

Screenshot 2024-05-19 at 16 45 40

I looked inside the dist folder and there is a package.json file generated in both folders:

When i manually remove this package.json files and run the command again it will succeed. I guess these files don't have a name prop which nx expects?

Expected Behavior

It's possible to run all commands without removing package.json files. I think this issue could be related to #20959.

GitHub Repo

No response

Steps to Reproduce

As my project is a private repo i can't share the source code.

Nx Report

Node   : 20.8.0
OS     : darwin-arm64
npm    : 10.1.0

nx (global)        : 19.0.4
nx                 : 19.0.4
@nx/js             : 19.0.4
@nx/jest           : 19.0.4
@nx/linter         : 19.0.4
@nx/eslint         : 19.0.4
@nx/workspace      : 19.0.4
@nx/cypress        : 19.0.4
@nx/devkit         : 19.0.4
@nx/eslint-plugin  : 19.0.4
@nx/next           : 19.0.4
@nx/playwright     : 19.0.4
@nx/react          : 19.0.4
@nx/rollup         : 19.0.4
@nx/storybook      : 19.0.4
@nrwl/tao          : 19.0.4
@nx/web            : 19.0.4
@nx/webpack        : 19.0.4
typescript         : 5.4.5
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/rollup/plugin

Failure Logs

No response

Package Manager Version

No response

Operating System

Additional Information

No response

jogelin commented 4 days ago

Same issue here. I didn't investigate why exactly but it is related to:

guillempuche commented 4 days ago

Similar when running my main Expo app. Tested in Nx 19 macos

Storybook is in its own standalone React Native app. Storybook packages v7.6.10 and v7.6.15 for @storybook/react-native.

Nx docs https://nx.dev/recipes/storybook/custom-builder-configs#and are outdated, framework field doesn't exist in StorybookConfig.

yarn exec nx run expo:start
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
  The "@nx/storybook/plugin" plugin threw an error while creating nodes from apps/storybook-rn/.storybook/main.ts:
    TypeError: Cannot read properties of undefined (reading 'name')
        at getStorybookFramework (/Users/guillem/programacio/codi/cites/nx-expo-next-tamagui/node_modules/@nx/storybook/src/plugins/plugin.js:170:66)
        at buildStorybookTargets (/Users/guillem/programacio/codi/cites/nx-expo-next-tamagui/node_modules/@nx/storybook/src/plugins/plugin.js:68:32)
        at Array.exports.createNodes (/Users/guillem/programacio/codi/cites/nx-expo-next-tamagui/node_modules/@nx/storybook/src/plugins/plugin.js:53:32)
        at /Users/guillem/programacio/codi/cites/nx-expo-next-tamagui/node_modules/nx/src/project-graph/plugins/utils.js:49:27
        at async Promise.all (index 0)
jogelin commented 3 days ago

I fixed my problem.

My error was a bit different:

Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
  ProjectsWithNoNameError: The projects in the following directories have no name provided:
    - apps\my-app-one
    - apps\my-app-two
    - apps\my-app-three
    - ...

All of the apps above were related to a specific Nx plugin using target inference.

Nx can inject targets into a project configuration by comparing the projectRoot computed with the projectRoot from the list of existing projects . However, the projectRoot computed can be different between a Windows environment and a Unix environment.

This is why Nx created the utility normalizePath to avoid that use case:

const projectRoot = normalizePath(join(dirname(configFilePath), '..'));