Nx: Bug: `npm run lint` fails on freshly generated project

Created on 1 Aug 2019  路  3Comments  路  Source: nrwl/nx

Prerequisites

  • [x] I am running the latest version
  • [x] I checked the documentation and found no answer
  • [x] I checked to make sure that this issue has not already been filed
  • [x] I'm reporting the issue to the correct repository (not related to Angular, AngularCLI or any dependency)

Expected Behavior

When running npm run lint go through all linting.

Current Behavior

When I'm running a npm run lint I'm getting an error An unhandled exception occurred: Could not find module "@nrwl/linter".

The following code in angular.json causes this:

"lint": {
  "builder": "@nrwl/linter:lint",
  "options": {
    "linter": "tslint",
    "tsConfig": ["apps/ditectrev-e2e/tsconfig.e2e.json"],
    "exclude": ["**/node_modules/**", "!apps/ditectrev-e2e/**"]
  }
}

Changing to the following lints all the files in the workspace correctly again (taken from older versions):

"lint": {
  "builder": "@angular-devkit/build-angular:tslint",
  "options": {
    "tsConfig": ["apps/ditectrev-e2e/tsconfig.e2e.json"],
    "exclude": ["**/node_modules/**", "!apps/ditectrev-e2e/**"]
  }
}

Or simply npm install @nrwl/linter --save-dev, but the module @nrwl/linter is not included in a freshly generated Nx workspace. I see that @nrwl/linter is a very fresh package, but at this point of time (yesterday) it has been not included in devDependencies.

Would be great to have it in a freshly generated workspace correctly.

Failure Information (for bugs)

An unhandled exception occurred: Could not find module "@nrwl/linter"

Steps to Reproduce

  1. Generate a new Nx workspace project
  2. Run npm run lint

Context

$ ng version

Angular CLI: 8.1.2
Node: 10.15.3
OS: win32 x64
Angular: 8.2.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.801.1
@angular-devkit/build-angular     0.800.6
@angular-devkit/build-optimizer   0.800.6
@angular-devkit/build-webpack     0.800.6
@angular-devkit/core              8.1.1
@angular-devkit/schematics        8.1.1
@angular/cli                      8.1.1
@ngtools/webpack                  8.0.6
@schematics/angular               8.1.1
@schematics/update                0.801.1
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.30.0

$ npm ls @nrwl/angular @nrwl/workspace
+-- @nrwl/[email protected]
`-- @nrwl/[email protected]

$ npm ls @angular/cli
`-- @angular/[email protected]

Others

It has been checked with Angular.

bug

All 3 comments

@danieldanielecki could you provide a repository with a repro?

@nrwl/web has a dependency on @nrwl/linter, so I'm curious what your package-lock.json file looks like.

I found the issue. The user only has an Angular project so there is no dependency on @nrwl/web or @nrwl/node and thus no dependency on @nrwl/lint.

Fixed by #1692

Was this page helpful?
0 / 5 - 0 ratings