nx icon indicating copy to clipboard operation
nx copied to clipboard

Cannot find project 'web'

Open mdungmc opened this issue 1 year ago • 8 comments

Current Behavior

Anytime I run npm start web, i always got: Cannot find project 'web'

Expected Behavior

I just want to run the project

GitHub Repo

No response

Steps to Reproduce

Firstly I ran project successfully, but accidentally, the project is crashed like now.

Nx Report

Node           : 20.15.1
OS             : win32-x64
Native Target  : wasm32
npm            : 10.7.0

nx (global)        : 19.8.2
nx                 : 19.7.3
@nx/js             : 19.7.3
@nx/jest           : 19.7.3
@nx/linter         : 19.7.3
@nx/eslint         : 19.7.3
@nx/workspace      : 19.7.3
@nx/devkit         : 19.7.3
@nx/eslint-plugin  : 19.7.3
@nx/nest           : 19.7.3
@nx/node           : 19.7.3
@nx/react          : 19.7.3
@nrwl/tao          : 19.7.3
@nx/vite           : 19.7.3
@nx/web            : 19.7.3
@nx/webpack        : 19.7.3
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/vite/plugin
@nx/eslint/plugin
@nx/jest/plugin
@nx/webpack/plugin
nx/plugins/package-json

Failure Logs

Admin@Maduro MINGW64 /d/Workspace/caai (main)
$ npm start web

> [email protected] start
> nx serve web


 NX   The Nx Daemon is unsupported in WebAssembly environments. Some things may be slower than or not function as expected.


 NX   Cannot find project 'web'

Package Manager Version

npm 20.15.1

Operating System

  • [ ] macOS
  • [ ] Linux
  • [X] Windows
  • [ ] Other (Please specify)

Additional Information

No response

mdungmc avatar Sep 26 '24 07:09 mdungmc

Same here. Since yesterday nx does not see any projects in nx workspaces anymore on my system. That also happens when I create an entirely new workspace using npx create-nx-workspace to create a fresh workspace. It seems the graph does not yield any projects in the workspace.

Scaffolding a new project using npx nx g @nrwl/angular:application some-project will add a project to the graph, which then shows up. However, if I delete the .nx folder in the workspace, that project is also never reflected on the graph again. It seems graph creation is broken.

I am on MacOS 15.

Node : 20.17.0 OS : darwin-arm64 Native Target : aarch64-macos yarn : 4.5.0

nx : 19.8.2 @nx/js : 19.8.2 @nx/jest : 19.8.2 @nx/linter : 19.8.2 @nx/eslint : 19.8.2 @nx/workspace : 19.8.2 @nx/angular : 19.8.2 @nx/devkit : 19.8.2 @nx/eslint-plugin : 19.8.2 @nrwl/tao : 19.8.2 @nx/web : 19.8.2 @nx/webpack : 19.8.2 typescript : 5.5.4

binarybro avatar Sep 26 '24 09:09 binarybro

I tried to clone the project again, try to reinstall anything I can (Windows, npm, node, ...) but the problem have not repaired.

mdungmc avatar Sep 26 '24 09:09 mdungmc

same here: removed node, npm, yarn, eventually volta entirely. removed homebrew entirely. remove any plugins for zsh. any nx workspace i have on the system, nx appears to yield an empty graph.

binarybro avatar Sep 26 '24 10:09 binarybro

It does not matter what kind of project I create. react, angular all the same.

npx create-nx-workspace

% npx create-nx-workspace nx-test

 NX   Let's create a new workspace [https://nx.dev/getting-started/intro]

✔ Which stack do you want to use? · react
✔ What framework would you like to use? · nextjs
✔ Integrated monorepo, or standalone project? · integrated
✔ Application name · nx-test
✔ Would you like to use the App Router (recommended)? · No
✔ Would you like to use the src/ directory? · Yes
✔ Test runner to use for end to end (E2E) tests · none
✔ Default stylesheet format · css
✔ Which CI provider would you like to use? · skip
✔ Would you like remote caching to make your build faster? · skip

 NX   Creating your v19.8.2 workspace.

✔ Installing dependencies with npm
✔ Successfully created the workspace: nx-test.

% nx show project nx-test      
Could not find project nx-test

% cat .nx/workspace-data/project-graph.json 
{
  "nodes": {},
  "externalNodes": {},
  "dependencies": {},
  "version": "6.0"
}

binarybro avatar Sep 26 '24 10:09 binarybro

In my case the culprit was a .gitignore file in a parent directory with a wildcard. That file is in my home directory, where I also have a projects directory. Apparently Nx considers a parent directory's .gitignore somehow. Anyways, for me this issue is resolved.

binarybro avatar Sep 26 '24 13:09 binarybro

In my case the culprit was a .gitignore file in a parent directory with a wildcard. That file is in my home directory, where I also have a projects directory. Apparently Nx considers a parent directory's .gitignore somehow. Anyways, for me this issue is resolved.

As stated by @binarybro .gitignore in my home dir was the problem because of the wildcard. Workspace works after the following steps:

  • npx create-nx-workspace@latest
  • cd to your workspace dir
  • rm -rf .nx
  • git init
  • add !* to .gitingore
  • run any nx command now

smilovanovic avatar Sep 26 '24 14:09 smilovanovic

In my case the culprit was a .gitignore file in a parent directory with a wildcard. That file is in my home directory, where I also have a projects directory. Apparently Nx considers a parent directory's .gitignore somehow. Anyways, for me this issue is resolved.

Thanks so much! I hit the same issue.

I think this is a bug in nx. I have my nx workspace in a directory tree that somewhere along the ladder has a parent folder that was also a git repository ignoring all of its subfolders, nx just mysteriously couldn't find any projects in the workspace.

nx should probably stop looking for parent .gitignores at the root of the repository / workspace?

This is the structure I had

/foo
/foo/.gitignore
/foo/bar
/foo/bar/pnpm-workspace.yml
/foo/bar/apps/
/foo/bar/apps/project-that-should-be-visible
# …

Both /foo and /foo/bar were git repositories. /foo/.gitignore contained a single line with */.

/foo/bar/pnpm-workspace.yml looks like this:

packages:
  - apps/*

/foo/bar is the nx repository, and no projects could be found, even though all subfolders were visible to the git repository in /foo/bar.

rrrnld avatar Oct 14 '24 14:10 rrrnld

this is similar to https://github.com/nrwl/nx/issues/27368 reported few month ago, issue started from nx v19.5

amirhosseinadev avatar Oct 16 '24 11:10 amirhosseinadev

This issue has been automatically marked as stale because it hasn't had any activity for 6 months. Many things may have changed within this time. The issue may have already been fixed or it may not be relevant anymore. If at this point, this is still an issue, please respond with updated information. It will be closed in 21 days if no further activity occurs. Thanks for being a part of the Nx community! 🙏

github-actions[bot] avatar May 11 '25 00:05 github-actions[bot]

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[bot] avatar Jul 02 '25 00:07 github-actions[bot]