nx: (bug) Cannot read property 'lint' of undefined when converting ng app to nrwl workspace
Expected Behavior
Convert my angular cli workspace to an nx workspace
Results from trying to convert my existing app
Here is my current angular cli workspace file structure:
All the npm script like “npm run lint” and “npm run start” work. The app runs successfully without compiler errors on port 4200.
When I try to convert this workspace into a nrwl workspace by using ng add @nrwl/workspace it errors outs with "Cannot read property ‘lint’ of undefined.

Steps to Reproduce
git clone https://github.com/webmandman/angular-app-workspace-example.git npm install ng add @nrwl/workspace
Environment
Node : 14.11.0 OS : win32 x64 npm : 6.14.8
nx : Not Found @nrwl/angular : 8.12.11 @nrwl/cli : 11.2.10 @nrwl/cypress : 8.12.11 @nrwl/devkit : 11.2.10 @nrwl/eslint-plugin-nx : Not Found @nrwl/express : Not Found @nrwl/jest : 11.2.10 @nrwl/linter : 11.2.10 @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : Not Found @nrwl/react : Not Found @nrwl/schematics : 8.12.11 @nrwl/tao : 11.2.10 @nrwl/web : Not Found @nrwl/workspace : 11.2.10 typescript : 4.0.5
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 19 (3 by maintainers)
I found workaround: usually we have angular-e2e project inside angular.json but nx monorepo currently don’t support transformation of multi project angular cli workspace transformation to nx monorepo workspace.
When i try to execute:
ng add @nrwl/workspace --preserveAngularCLILayoutI got error:The schematic can only be used with Angular CLI workspaces with a single application.Then i found answer about it in Stackoverflow and delete my
projectname-e2efromangular.jsonand triedng add @nrwl/workspaceand it executed successfully.Got into this same issue. Have an Angular project, 11.2.12 (latest non RC), with the default e2e app alongside. Using
ng add @nrwl/workspaceonly adds"@nrwl/angular": "12.1.1"to the package.json, and fails with theCannot read property 'lint' of undefinedmessage.Removing it as a workaround from the
angular.jsonfile makes the add command execute correctly, but I noticed the add command printedNo e2e project was migrated because there was none declared in angular.jsonso the command supposedly supports migrating an e2e app as well.Also, yes, for the 2nd bug discussed, empty directories from the previous
src/appwere left after the add command finished successfully .I don’t like pinging people but @FrozenPandaz this got closed automatically but it may be still considered an issue.
@maxisam What pumano did above, on the Feb 7 comment https://github.com/nrwl/nx/issues/4708#issuecomment-774710237:
Deleted the e2e project from the
angular.jsonthen run the migrationng add @nrwl/workspacecommand. Then manually re-add the e2e project and migrate it manually: move to be inside theappsdirectory (if not already), and update it’s paths and the lint builder/executor. The lint should be something likeYou could use a fresh temporal Nx project just as reference of how it should be.
Have the same issue in V12. @edmundo096 Could you share what did you remove? thx
My angular is v12 and nx is v12. So I don’t understand why it doesn’t work