question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not find project "@ngneat/tailwind" when running in an nx workspace

See original GitHub issue

I’m submitting a…


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x ] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

Running the add schematics commands results in the following errors when used on a newly-created NX workspace.

  1. nx add @ngneat/tailwind = Could not find project “@ngneat/tailwind

  2. ng add @ngneat/tailwind = The add command requires to be run in an Angular project, but a project definition could not be found.

For clarification and as pointed out below, this does not work in an NX workspace using the NX cli.

Expected behavior

TailwindCSS is added correctly.

Minimal reproduction of the problem with instructions

  1. Create new NX latest workspace, empty and CLI used is NX: npx create-nx-workspace@latest

  2. Add new Angular app: nx g @nrwl/angular:app sample-app --routing --style=scss

  3. Add @ngneat/tailwind: nx add @ngneat/tailwind

What is the motivation / use case for changing the behavior?

I want to use TailwindCSS for a collection apps in an NX workspace.

Environment


Angular version: 10.0.0


Browser:
- [] Chrome (desktop) version XX
- [] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [x] Edge version XX
 
For Tooling issues:
- Node version: 12.16.1
- Platform:  Windows

Others:

By the way, this schematics and the one before it works in an Angular workspace. Thank you for the great work.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
lhargilcommented, Sep 28, 2020

@lhargil I took a closer look at a Nx Workspace support for Angular schematics. Unfortunately, . @ngneat/tailwind greatly depends on Angular Schematics utilities and there are so many discrepancies between Angular and Nx schematics utilities:

  • getWorkspace(): Angular’s getWorkspace() is a synchronous function where as Nx’s is an asynchronous.
  • getProjectFromWorkspace(): There’s no equivalent in Nx Workspace utilities. Looking through Nx’s source code for how they get the project from the workspace, it’s just workspace.projects.get(projectName).
  • getTargetsByBuilderName(): There’s no equivalent in Nx Workspace utilities. This method is to look for all records under architect that current have @angular-devkit/build-angular:browser or @angular-devkit/build-angular:dev-server to replace them with the ones from @angular-builders/custom-webpack:*.

With that in mind, I decided to not support pure Nx Workspace with workspace.json for now. Please consider using Angular CLI powered Nx workspace instead (with angular.json). However, I will keep this request in mind.

Thank you for taking a look, @nartc. I understand where you’re coming from and it is fine by me. In the meantime, I got by, by manually adding the changes to the nx project, works as intended. 👍

0reactions
nartccommented, Oct 5, 2020

Closing. Might revisit

Read more comments on GitHub >

github_iconTop Results From Across the Web

@ngneat/tailwind - npm
Start using @ngneat/tailwind in your project by running `npm i ... If you setup your Nx Workspace to use AngularCLI , the usage...
Read more >
How to add Tailwind CSS to your NX Angular Workspace
Tailwind CSS is a superb utility first CSS framework that has taken the world of component first development by storm. It can be...
Read more >
Set up Tailwind CSS with Angular in an Nx workspace
In this blog post, we are going to see how we can use Tailwind CSS with Angular in an Nx monorepo. We are...
Read more >
nrwl nx - ng command not identifying angular workspace
SOLUTION: npx nx g @angular/material:ng-add --project=my-project-name , as stated here: a solution for adding @angular/material to a Nx ...
Read more >
How to configure TailwindCSS with Angular and why you ...
Simply run a single command on your Angular CLI project, and you are all set! ng add @ngneat/tailwind. See more ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found