Nx: yarn lint error

Created on 25 Apr 2018  路  5Comments  路  Source: nrwl/nx

Hi there,

When running yarn lintI suddenly get this message ... not sure where to fix that as the package,json (and yarn.lock) has same versions, namely 1.0.2 (same as global version of schematics).

The cli is at 1.7.4

Here the error trace:

yarn run v1.6.0
$ ./node_modules/.bin/nx lint && ng lint
The package.json is inconsistent:
The versions of the @nrwl/nx and @nrwl/schematics packages must be the same.

Here the dependencies from the package.json:
"dependencies": { "@agm/core": "^1.0.0-beta.2", "@angular/animations": "^5.2.7", "@angular/cdk": "^5.2.3", "@angular/common": "^5.2.7", "@angular/compiler": "^5.2.7", "@angular/core": "^5.2.7", "@angular/flex-layout": "^5.0.0-beta.13", "@angular/forms": "^5.2.7", "@angular/material": "^5.2.3", "@angular/material-moment-adapter": "^5.2.3", "@angular/platform-browser": "^5.2.7", "@angular/platform-browser-dynamic": "^5.2.7", "@angular/router": "^5.2.7", "@angular/service-worker": "^5.2.2", "@ngrx/effects": "^5.1.0", "@ngrx/router-store": "^5.0.1", "@ngrx/store": "^5.1.0", "@ngx-translate/i18n-polyfill": "^0.1.2", "@types/jwt-decode": "^2.2.1", "@types/lodash": "^4.14.67", "core-js": "^2.4.1", "dragula": "^3.7.2", "jwt-decode": "^2.2.0", "localforage": "^1.5.6", "lodash": "^4.17.4", "material-design-icons": "^3.0.1", "moment": "^2.20.1", "ng2-dragula": "^1.5.0", "ngx-img-cropper": "^0.10.2", "ngx-moment": "^2.0.0-rc.0", "roboto-fontface": "^0.9.0", "rxjs": "^5.5.6", "tinymce": "^4.5.5", "zone.js": "^0.8.19" }, "devDependencies": { "@angular/cli": "^1.7.2", "@angular/compiler-cli": "^5.2.7", "@angular/language-service": "^5.2.7", "@angularclass/hmr": "^2.1.3", "@ngrx/store-devtools": "^5.1.0", "@nrwl/nx": "^1.0.2", "@nrwl/schematics": "^1.0.2", "@types/jasmine": "~2.5.53", "@types/jasminewd2": "~2.0.2", "@types/node": "~6.0.60", "codelyzer": "^4.0.1", "git-describe": "^4.0.2", "gulp": "^4.0.0", "gulp-brotli": "^1.2.1", "gulp-zopfli": "^1.0.0", "jasmine-core": "~2.8.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~2.0.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "prettier": "1.11.1", "protractor": "~5.1.2", "rxjs-tslint-rules": "^3.17.0", "ts-node": "~4.1.0", "tslint": "~5.9.1", "typescript": "2.6.2" }

Most helpful comment

The error message is confusing. The problem here is that "@nrwl/nx" is not a dev dependency. It should be moved into dependencies. The check reads dependencies['@nrwl/nx'], gets undefined, and errors.

I'll improve the error message.

All 5 comments

The error message is confusing. The problem here is that "@nrwl/nx" is not a dev dependency. It should be moved into dependencies. The check reads dependencies['@nrwl/nx'], gets undefined, and errors.

I'll improve the error message.

@vsavkin Can you confirm if this issue was fixed? If so, in which version?

I am still seeing this issue using the following versions:

Angular CLI: 6.1.5
Node: 10.4.1
OS: darwin x64
Angular: 6.1.4
@nrwl/nx 6.2.1
@nrwl/schematics 6.2.1

Had the same problem after moving package @nrwl/nx from dependencies to devDependencies in package.json. Reverting it back solved it.

Question is more like why actually @nrwl/nx is not a dev dependency?

@skorunka I think because @nrwl/nx contains code that is actually imported by production code (NxModule), whereas @nrwl/schematics only contains scripts for build tooling.

Had the same issue though, thanks for the solution.

Was this page helpful?
0 / 5 - 0 ratings