I have an Nx project (not an Angular one). And I have created a lib named 'api'.
If I execute: npm run lint api it fails with the following error:
Cannot find module '@angular-devkit/build-angular/package.json'
If I install @angular-devkit/build-angular, everything works as expected.
But I suppose, it should be already installed by Nx. I don't think, it's correct if I install it by myself.
It should successfully perform linting of my library.
I don't know whether it was working before, because I haven't used Nx before.
Just create an Nx project (not an Angular one) and run aforementioned command.
npm run lint api
> nx workspace-lint && nx lint "api"
> nx run api:lint
Cannot find module '@angular-devkit/build-angular/package.json'
Require stack:
- /Users/victor/Development/projects/healthy-intellect/hi/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js
- /Users/victor/Development/projects/healthy-intellect/hi/node_modules/@angular-devkit/architect/node/index.js
- /Users/victor/Development/projects/healthy-intellect/hi/node_modules/@nrwl/tao/src/commands/run.js
- /Users/victor/Development/projects/healthy-intellect/hi/node_modules/@nrwl/tao/index.js
- /Users/victor/Development/projects/healthy-intellect/hi/node_modules/@nrwl/cli/lib/run-cli.js
@nrwl/angular : Not Found
@nrwl/cli : 9.5.1
@nrwl/cypress : Not Found
@nrwl/eslint-plugin-nx : 9.5.1
@nrwl/express : Not Found
@nrwl/jest : 9.5.1
@nrwl/linter : 9.5.1
@nrwl/nest : 9.5.1
@nrwl/next : Not Found
@nrwl/node : 9.5.1
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 9.5.1
@nrwl/web : Not Found
@nrwl/workspace : 9.5.1
typescript : 3.8.3
Thanks for raising this @siberian-man - unfortunately I can't reproduce this issue. Can you provide a link to a repo where this happens? Or exact steps to reproduce?
I've tried the following steps but it works fine 🤷♀️ (this all results in an Nx report identical to yours)
npx create-nx-workspace test --preset=emptycd testnpm i -D @nrwl/nestnx g @nrwl/nest:application apinpm run lint apiWas there something unusual about the way you created the workspace?
@siberian-man thx for reporting, but I cannot reproduce the issue either 😕 I am going to close this now, as it is not actionable atm, but feel to to reopen if you have more info that will help us understand your case.
@jdpearce @bekos Sorry for the long silence. I suppose, you were unable to reproduce because api is a library in my setup, not an application. I also can lint applications successfully. But Nx fails to lint library.
A couple of additional notes:
nx lint api // fails
npm run nx lint api // fails
I'm running into this issue, it only has happened to a library that uses ES Lint rather than TS Lint. Not sure what Linter you are using @siberian-man
If I change back to TS Lint. It works fine.
Note, I'm I'm attempting to BOTH TS Lint and ES Lint in NX
So it seem the config setup is looking for @angular-devkit rather than @nrwl/linter:lint
@bekos Any thoughts on this?
@michael-letcher @siberian-man there are already major improvements for ESLint support in the upcoming 10.3 release, so probably this will not be an issue anymore. Nevertheless, if you can provide the reproduction steps, or even better a reproduction repository it will help us jump right into the problem, debug and provide the fix. Otherwise, you understand that this is very difficult.
@bekos Tried out 10.3 and this fixed the issue.
Happens to me when scaffold workspace with an "empty" preset. Seems like there is no "lint" command at all
Doesn't happen when scaffold with an "angular-nest" preset. IMO, it also doesn't fail in any preset where angular included, didn't test them all, kinda idea 🤷
Current create-nx-workspace version is 11.0.8