nx: 13 Migration: TypeError: Cannot read properties of undefined (reading 'data')
Current Behavior
Running nx serve after migrating to 13 produces an error. Could that be because prettier has an incorrect version?
https://github.com/nrwl/nx/blob/master/packages/workspace/src/core/hasher/hasher.ts#L347
Expected Behavior
Steps to Reproduce
Haven’t tested yet (going to after setting up a 12 workspace):
- setup 12 workspace
- migrate to 13
- Update some dependencies manually like prettier and eslint
nx serve
Failure Logs
/D/app on update-workspace [!] via v16.13.0 at 08:56:25
; pnpm dev
> entergon-workspace@ dev /Users/marvin/Development/app
> nx serve
/Users/marvin/Development/app/node_modules/.pnpm/@nrwl+workspace@13.1.3_prettier@2.4.1+ts-node@10.3.0/node_modules/@nrwl/workspace/src/core/hasher/hasher.js:245
res(this.hashing.hashArray([n.data.version]));
^
TypeError: Cannot read properties of undefined (reading 'data')
at ProjectHasher.<anonymous> (/Users/marvin/Development/app/node_modules/.pnpm/@nrwl+workspace@13.1.3_prettier@2.4.1+ts-node@10.3.0/node_modules/@nrwl/workspace/src/core/hasher/hasher.js:245:55)
at Generator.next (<anonymous>)
at /Users/marvin/Development/app/node_modules/.pnpm/tslib@2.3.1/node_modules/tslib/tslib.js:117:75
at new Promise (<anonymous>)
at Object.__awaiter (/Users/marvin/Development/app/node_modules/.pnpm/tslib@2.3.1/node_modules/tslib/tslib.js:113:16)
at /Users/marvin/Development/app/node_modules/.pnpm/@nrwl+workspace@13.1.3_prettier@2.4.1+ts-node@10.3.0/node_modules/@nrwl/workspace/src/core/hasher/hasher.js:240:79
at new Promise (<anonymous>)
at ProjectHasher.<anonymous> (/Users/marvin/Development/app/node_modules/.pnpm/@nrwl+workspace@13.1.3_prettier@2.4.1+ts-node@10.3.0/node_modules/@nrwl/workspace/src/core/hasher/hasher.js:240:50)
at Generator.next (<anonymous>)
at /Users/marvin/Development/app/node_modules/.pnpm/tslib@2.3.1/node_modules/tslib/tslib.js:117:75
Node.js v17.0.1
ELIFECYCLE Command failed with exit code 1.
package.json Diff
diff --git a/package.json b/package.json
index 27945aa9..e82668df 100644
--- a/package.json
+++ b/package.json
@@ -28,7 +28,7 @@
"dep-graph": "nx dep-graph"
},
"dependencies": {
- "@agm/core": "^1.1.0",
+ "@agm/core": "^3.0.0-beta.0",
"@angular/animations": "12.2.9",
"@angular/common": "12.2.9",
"@angular/core": "12.2.9",
@@ -38,18 +38,18 @@
"@angular/router": "12.2.9",
"@angular/service-worker": "12.2.9",
"@capacitor-community/contacts": "^1.1.3",
- "@capacitor/app": "^1.0.3",
- "@capacitor/browser": "^1.0.3",
- "@capacitor/camera": "^1.1.0",
- "@capacitor/core": "^3.2.4",
- "@capacitor/device": "^1.0.3",
- "@capacitor/filesystem": "^1.0.3",
- "@capacitor/keyboard": "^1.1.0",
- "@capacitor/network": "^1.0.3",
- "@capacitor/share": "^1.0.4",
- "@capacitor/splash-screen": "^1.1.3",
- "@capacitor/status-bar": "^1.0.3",
- "@capacitor/storage": "^1.2.0",
+ "@capacitor/app": "^1.0.6",
+ "@capacitor/browser": "^1.0.6",
+ "@capacitor/camera": "^1.2.0",
+ "@capacitor/core": "^3.3.0",
+ "@capacitor/device": "^1.0.6",
+ "@capacitor/filesystem": "^1.0.6",
+ "@capacitor/keyboard": "^1.1.3",
+ "@capacitor/network": "^1.0.6",
+ "@capacitor/share": "^1.0.7",
+ "@capacitor/splash-screen": "^1.1.6",
+ "@capacitor/status-bar": "^1.0.6",
+ "@capacitor/storage": "^1.2.3",
"@fortawesome/fontawesome-pro": "^5.15.4",
"@ionic-native/android-full-screen": "^5.36.0",
"@ionic-native/android-permissions": "^5.36.0",
@@ -72,56 +72,56 @@
"@ionic-native/screen-orientation": "^5.36.0",
"@ionic-native/splash-screen": "^5.36.0",
"@ionic-native/sqlite": "^5.36.0",
- "@ionic/angular": "^5.8.4",
- "@ionic/core": "^5.8.4",
+ "@ionic/angular": "^5.8.5",
+ "@ionic/core": "^5.8.5",
"@ionic/pwa-elements": "^3.0.2",
- "@ionic/storage": "^2.3.1",
- "@ngneat/transloco": "^3.0.4",
+ "@ionic/storage-angular": "^3.0.6",
+ "@ngneat/transloco": "^3.0.7",
"@ngneat/transloco-locale": "^3.0.1",
"@ngneat/transloco-persist-translations": "^3.0.1",
"@ngneat/transloco-preload-langs": "^3.0.2",
- "@sentry/angular": "^6.13.3",
+ "@sentry/angular": "^6.14.0",
"@sentry/capacitor": "^0.4.0",
- "@sentry/tracing": "^6.13.3",
+ "@sentry/tracing": "^6.14.0",
"@swimlane/ngx-datatable": "^20.0.0",
"@zxing/browser": "0.0.9",
"@zxing/library": "^0.18.6",
"@zxing/ngx-scanner": "^3.2.0",
"animate.css": "^4.1.1",
- "com-sarriaroman-photoviewer": "1.1.18",
+ "com-sarriaroman-photoviewer": "^1.2.5",
"cordova-open-native-settings": "^1.5.5",
"cordova-plugin-android-permissions": "^1.1.2",
"cordova-plugin-badge": "^0.8.8",
- "cordova-plugin-camera": "^4.1.0",
+ "cordova-plugin-camera": "^6.0.0",
"cordova-plugin-device": "^2.0.3",
- "cordova-plugin-document-viewer": "0.9.10",
+ "cordova-plugin-document-viewer": "^1.0.0",
"cordova-plugin-email-composer": "^0.9.2",
"cordova-plugin-file": "^6.0.2",
- "cordova-plugin-file-transfer": "github:sitewaerts/cordova-plugin-file-transfer",
+ "cordova-plugin-file-transfer": "^1.7.1",
"cordova-plugin-fullscreen": "^1.3.0",
"cordova-plugin-globalization": "^1.11.0",
"cordova-plugin-google-analytics": "^1.9.0",
- "cordova-plugin-inappbrowser": "^4.1.0",
+ "cordova-plugin-inappbrowser": "^5.0.0",
"cordova-plugin-insomnia": "^4.3.0",
"cordova-plugin-local-notification": "^0.9.0-beta.2",
- "cordova-plugin-network-information": "^2.0.2",
+ "cordova-plugin-network-information": "^3.0.0",
"cordova-plugin-screen-orientation": "^3.0.2",
- "cordova-plugin-simple-image-resizer": "github:JoschkaSchulz/cordova-plugin-image-resizer#v0.2.0",
+ "cordova-plugin-simple-image-resizer": "^0.2.0",
"cordova-plugin-splashscreen": "^6.0.0",
"cordova-plugin-whitelist": "^1.3.5",
"cordova-sqlite-storage": "^6.0.0",
"cordova-windows": "^7.0.1",
- "core-js": "^2.6.12",
+ "core-js": "3.16.0",
"dayjs": "^1.10.7",
"es6-promise-plugin": "^4.2.2",
"hash-wasm": "^4.9.0",
"info.protonet.imageresizer": "0.1.1",
- "ionicons": "^5.5.3",
+ "ionicons": "^5.5.4",
"localforage": "^1.10.0",
"lodash-es": "^4.17.21",
"merge-images": "^2.0.0",
"ng-in-viewport": "^6.1.5",
- "ngx-extended-pdf-viewer": "^10.5.0-alpha.0",
+ "ngx-extended-pdf-viewer": "^10.5.0",
"ngx-pinch-zoom": "^2.6.2",
"phonegap-plugin-barcodescanner": "^8.1.0",
"plyr": "^3.6.9",
@@ -148,62 +148,61 @@
"@angular/compiler-cli": "12.2.9",
"@angular/language-service": "12.2.9",
"@capacitor-community/electron": "^4.0.3",
- "@capacitor/android": "^3.2.4",
- "@capacitor/cli": "^3.2.4",
- "@capacitor/ios": "^3.2.4",
+ "@capacitor/android": "^3.3.0",
+ "@capacitor/cli": "^3.3.0",
+ "@capacitor/ios": "^3.3.0",
"@compodoc/compodoc": "^1.1.15",
- "@ionic/angular-toolkit": "^4.0.0",
- "@ionic/cli": "^6.17.1",
- "@nrwl/angular": "12.10.0",
- "@nrwl/cli": "12.10.0",
- "@nrwl/cypress": "12.10.0",
- "@nrwl/devkit": "12.10.0",
- "@nrwl/eslint-plugin-nx": "12.10.0",
- "@nrwl/jest": "12.10.0",
- "@nrwl/linter": "12.10.0",
- "@nrwl/tao": "12.10.0",
- "@nrwl/workspace": "12.10.0",
+ "@ionic/angular-toolkit": "^5.0.0",
+ "@ionic/cli": "^6.18.0",
+ "@nrwl/angular": "13.1.3",
+ "@nrwl/cli": "13.1.3",
+ "@nrwl/cypress": "13.1.3",
+ "@nrwl/devkit": "13.1.3",
+ "@nrwl/eslint-plugin-nx": "13.1.3",
+ "@nrwl/jest": "13.1.3",
+ "@nrwl/linter": "13.1.3",
+ "@nrwl/tao": "13.1.3",
+ "@nrwl/workspace": "13.1.3",
"@nxtend/capacitor": "^11.1.1",
"@nxtend/ionic-angular": "^11.1.1",
- "@sentry/cli": "^1.69.1",
- "@sentry/webpack-plugin": "^1.18.0",
- "@testing-library/angular": "^10.11.0",
- "@testing-library/jest-dom": "^5.14.1",
+ "@sentry/cli": "^1.71.0",
+ "@sentry/webpack-plugin": "^1.18.3",
+ "@types/google.maps": "^3.46.0",
"@types/jest": "27.0.2",
"@types/lodash-es": "^4.17.5",
- "@types/node": "^14.17.18",
- "@types/semver": "^7.3.8",
+ "@types/node": "^16.11.6",
+ "@types/semver": "^7.3.9",
"@types/webpack": "^5.28.0",
"@typescript-eslint/eslint-plugin": "^5.3.0",
"@typescript-eslint/parser": "^5.3.0",
"cordova": "^10.0.0",
"cross-env": "^7.0.3",
- "cypress": "^8.6.0",
- "dotenv": "10.0.0",
- "eslint": "7",
- "eslint-config-prettier": "8.3.0",
+ "cypress": "^8.7.0",
+ "dotenv": "^10.0.0",
+ "eslint": "^8.1.0",
+ "eslint-config-prettier": "^8.3.0",
"eslint-import-resolver-typescript": "^2.5.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-unicorn": "^37.0.1",
"execa": "^5.1.1",
- "jest": "27.2.5",
- "jest-preset-angular": "10.0.1",
+ "jest": "27.3.1",
+ "jest-preset-angular": "10.1.0",
"jetifier": "^2.0.0",
- "jira-client": "^6.22.0",
+ "jira-client": "^6.23.0",
"kleur": "^4.1.4",
"prettier": "2.4.1",
- "stylelint": "14.0.1",
+ "stylelint": "^14.0.1",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-recess-order": "^2.5.0",
- "stylelint-config-recommended-scss": "5.0.0",
+ "stylelint-config-recommended-scss": "^5.0.1",
"stylelint-config-standard": "^23.0.0",
"stylelint-order": "^5.0.0",
"stylelint-prettier": "^1.2.0",
"stylelint-scss": "^4.0.0",
"ts-custom-error": "^3.2.0",
- "ts-jest": "27.0.5",
+ "ts-jest": "27.0.7",
"ts-node": "10.3.0",
"typescript": "4.3.5",
"webpack": "5.50.0"
Environment
> NX Report complete - copy this into the issue template
Node : 16.13.0
OS : darwin arm64
pnpm : 6.19.1
nx : 13.1.3
@nrwl/angular : 13.1.3
@nrwl/cli : 13.1.3
@nrwl/cypress : 13.1.3
@nrwl/devkit : 13.1.3
@nrwl/eslint-plugin-nx : 13.1.3
@nrwl/express : Not Found
@nrwl/jest : 13.1.3
@nrwl/linter : 13.1.3
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/nx-cloud : Not Found
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 13.1.3
@nrwl/web : Not Found
@nrwl/workspace : 13.1.3
@nrwl/storybook : 13.1.3
@nrwl/gatsby : Not Found
typescript : 4.3.5
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 22 (1 by maintainers)
nx clear-cacheSeems a remove of node_modules fixed the problem
In all these years, NX is by far the worst library I have ever worked with. Not even once has it worked without problems. It is interesting that even the project that works today may fail tomorrow without any changes and waste hours of your time to find the problem.
Same here. Reverting to 15.2.4 solved the issue.
I don’t know if this is relevant or useful for somebody else.
Something similar happened to me with wagmi and
yarn. The exact same output happened specifically after installing that package (so probably some other packages are presenting the same behaviour).Nothing worked other than switching to
npm. Not the best solution but it works in the meantime.nx injects too way deep into next js, and works horrible 😦
Definitely do not agree. Works fine for me.
Can you create reproduction repository with such error?
Started working again after upgrading to
15.4.4.