nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.47k stars 2.33k forks source link

TypeError: Cannot read property 'type' of undefined at Object.isNpmProject #7958

Closed Yohandah closed 2 years ago

Yohandah commented 2 years ago

Current Behavior

On some computers of my team, people are having this error :

(node:10932) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'type' of undefined at Object.isNpmProject (C:\Users\x\x\dev\x-v3\x\node_modules\@nrwl\workspace\src\core\project-graph\operators.js:52:20) at ProjectHasher. (C:\Users\x\x\dev\x-v3\x\node_modules\@nrwl\workspace\src\core\hasher\hasher.js:244:41) at Generator.next () at C:\Users\x\x\dev\x-v3\x\node_modules\tslib\tslib.js:117:75 at new Promise () at Object.__awaiter (C:\Users\x\x\dev\x-v3\x\node_modules\tslib\tslib.js:113:16) at C:\Users\x\x\dev\x-v3\x\node_modules\@nrwl\workspace\src\core\hasher\hasher.js:241:79 at new Promise () at ProjectHasher. (C:\Users\x\x\dev\x-v3\eexp\node_modules\@nrwl\workspace\src\core\hasher\hasher.js:241:50) at Generator.next ()

Deleting Nx cache then relaunch the NestJS app makes it work again, but why is that occuring ? We didn't update since a while (v12.9.0) and the version is fixed.

Expected Behavior

No error

Steps to Reproduce

I don't know ... it occurs on some computers of my team but not all of them.

Environment

  Node : 14.17.0
  OS   : win32 ia32
  npm  : 6.14.13

  nx : 12.9.0
  @nrwl/angular : 12.9.0
  @nrwl/cli : 12.9.0
  @nrwl/cypress : 12.9.0
  @nrwl/devkit : 12.9.0
  @nrwl/eslint-plugin-nx : 12.9.0
  @nrwl/express : Not Found
  @nrwl/jest : 12.9.0
  @nrwl/linter : 12.9.0
  @nrwl/nest : 12.9.0
  @nrwl/next : Not Found
  @nrwl/node : 12.9.0
  @nrwl/nx-cloud : Not Found
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 12.9.0
  @nrwl/web : Not Found
  @nrwl/workspace : 12.9.0
  @nrwl/storybook : 12.9.0
  @nrwl/gatsby : Not Found
  typescript : 4.3.5
AgentEnder commented 2 years ago

Can you upgrade to 12.10.1 or 13 and then check if it still occurs?

I've not seen this particular error before but wouldn't be shocked it it's caused by an outdated plugin or similar.

Are you using any community plugins?

Yohandah commented 2 years ago

Sorry for the late response, I can't check sorry because after deleting the Nx cache it's working again and I can't reproduce. Here's the full package.json if it can help you investigate :

{
   ...

  "private": true,
  "dependencies": {
    "@angular/animations": "13.0.0",
    "@angular/cdk": "13.0.0",
    "@angular/common": "13.0.0",
    "@angular/compiler": "13.0.0",
    "@angular/core": "13.0.0",
    "@angular/forms": "13.0.0",
    "@angular/localize": "13.0.0",
    "@angular/material": "13.0.0",
    "@angular/platform-browser": "13.0.0",
    "@angular/platform-browser-dynamic": "13.0.0",
    "@angular/pwa": "^12.2.1",
    "@angular/router": "13.0.0",
    "@angular/service-worker": "13.0.0",
    "@apollo/client": "^3.4.13",
    "@apollo/subgraph": "^0.1.5",
    "@auth0/angular-jwt": "^5.0.0",
    "@grpc/grpc-js": "^1.4.4",
    "@grpc/proto-loader": "^0.6.7",
    "@ionic/angular": "^5.6.13",
    "@ionic/core": "^5.6.13",
    "@nestjs-modules/mailer": "^1.6.0",
    "@nestjs/axios": "0.0.3",
    "@nestjs/common": "^8.0.0",
    "@nestjs/core": "^8.0.0",
    "@nestjs/event-emitter": "^1.0.0",
    "@nestjs/graphql": "^9.0.4",
    "@nestjs/jwt": "^8.0.0",
    "@nestjs/microservices": "^8.0.0",
    "@nestjs/passport": "^8.0.0",
    "@nestjs/platform-express": "^8.0.0",
    "@nestjs/schedule": "^1.0.1",
    "@nestjs/typeorm": "^8.0.0",
    "@ngrx/effects": "13.0.1",
    "@ngrx/entity": "13.0.1",
    "@ngrx/store": "13.0.1",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "@nrwl/angular": "13.2.3",
    "amqp-connection-manager": "^3.7.0",
    "amqplib": "^0.8.0",
    "angular-resize-event": "^3.0.2",
    "angular-split": "^4.0.0",
    "animejs": "^3.2.1",
    "apollo-angular": "^2.6.0",
    "apollo-link": "^1.2.14",
    "apollo-server": "^3.0.0",
    "apollo-server-core": "^3.5.0",
    "apollo-server-express": "^3.0.0",
    "apollo-server-plugin-base": "^3.4.0",
    "axios": "^0.24.0",
    "cache-manager": "^3.4.4",
    "cache-manager-redis-store": "^2.0.0",
    "class-transformer": "^0.4.0",
    "class-validator": "^0.13.1",
    "commander": "^8.3.0",
    "cookie-parser": "^1.4.5",
    "cross-fetch": "^3.1.4",
    "crypto-js": "^4.1.1",
    "cypress-mailhog": "^1.4.0",
    "d3-selection": "^1.4.0",
    "d3-zoom": "^1.8.3",
    "date-fns": "^2.23.0",
    "date-fns-tz": "^1.1.6",
    "eslint-plugin-ngrx": "^1.46.1",
    "fabric-with-gestures": "^4.5.0",
    "fs-extra": "^10.0.0",
    "graphql": "^15.5.1",
    "graphql-subscriptions": "^1.2.1",
    "graphql-tag": "^2.12.5",
    "graphql-tools": "^7.0.5",
    "graphql-type-json": "^0.3.2",
    "handlebars": "^4.7.7",
    "highcharts": "^9.1.2",
    "highcharts-angular": "^2.10.0",
    "highcharts-annotations": "^1.3.3",
    "highcharts-custom-events": "^3.0.2",
    "iconv-lite": "^0.6.3",
    "jsrsasign": "^10.4.0",
    "jsrsasign-util": "^1.0.5",
    "jszip": "^3.7.1",
    "jwk-to-pem": "^2.0.5",
    "kafkajs": "^1.15.0",
    "mqtt": "^4.2.8",
    "mysql": "^2.18.1",
    "nats": "^2.4.0",
    "nestjs-console": "^7.0.0",
    "ng-click-outside": "^5.0.0",
    "ngx-cookie-service": "^12.0.3",
    "nodemailer": "^6.7.2",
    "object-hash": "^2.2.0",
    "passport": "^0.4.1",
    "passport-jwt": "^4.0.0",
    "reflect-metadata": "^0.1.13",
    "rfc2047": "^3.0.1",
    "rimraf": "^3.0.2",
    "rxjs": "^7.4.0",
    "save": "^2.4.0",
    "sax": "^1.2.4",
    "short-uuid": "^4.2.0",
    "stream": "0.0.2",
    "tslib": "^2.0.0",
    "typeorm": "^0.2.34",
    "typescript-retry-decorator": "^2.0.3",
    "uuid": "^8.3.2",
    "xml2js": "^0.4.23",
    "zone.js": "0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "13.0.3",
    "@angular-eslint/builder": "^12.2.0",
    "@angular-eslint/eslint-plugin": "12.6.1",
    "@angular-eslint/eslint-plugin-template": "12.6.1",
    "@angular-eslint/template-parser": "12.6.1",
    "@angular/cli": "13.0.3",
    "@angular/compiler-cli": "13.0.0",
    "@angular/language-service": "13.0.0",
    "@commitlint/cli": "^12.1.4",
    "@commitlint/config-conventional": "^12.1.4",
    "@ionic/angular-toolkit": "^4.0.0",
    "@ionic/cli": "^6.17.0",
    "@nestjs/schematics": "^8.0.0",
    "@nestjs/testing": "^8.0.0",
    "@ngrx/store-devtools": "13.0.1",
    "@nrwl/cli": "13.2.3",
    "@nrwl/cypress": "13.2.3",
    "@nrwl/eslint-plugin-nx": "13.2.3",
    "@nrwl/jest": "13.2.3",
    "@nrwl/linter": "13.2.3",
    "@nrwl/nest": "13.2.3",
    "@nrwl/node": "13.2.3",
    "@nrwl/tao": "13.2.3",
    "@nrwl/workspace": "13.2.3",
    "@types/cache-manager": "^3.4.0",
    "@types/cookie-parser": "^1.4.2",
    "@types/cron": "^1.7.2",
    "@types/crypto-js": "^4.0.2",
    "@types/d3": "^5.7.2",
    "@types/express": "^4.17.12",
    "@types/express-jwt": "0.0.42",
    "@types/fabric": "^4.5.2",
    "@types/jest": "27.0.2",
    "@types/jsrsasign": "^8.0.3",
    "@types/node": "^15.14.7",
    "@types/nodemailer": "^6.4.4",
    "@types/object-hash": "^2.1.0",
    "@types/passport-jwt": "^3.0.5",
    "@types/uuid": "^8.3.0",
    "@types/validator": "^13.6.2",
    "@types/xml2js": "^0.4.4",
    "@typescript-eslint/eslint-plugin": "4.33.0",
    "@typescript-eslint/parser": "4.33.0",
    "copy-webpack-plugin": "^9.0.1",
    "cpy-cli": "^3.1.1",
    "cypress": "^9.1.0",
    "cypress-cucumber-preprocessor": "^4.2.0",
    "eslint": "7.32.0",
    "eslint-config-airbnb-typescript": "^12.3.1",
    "eslint-config-prettier": "8.1.0",
    "eslint-plugin-cypress": "^2.10.3",
    "eslint-plugin-eslint-comments": "^3.2.0",
    "eslint-plugin-import": "2.23.4",
    "eslint-plugin-jest": "^24.3.6",
    "eslint-plugin-jsdoc": "35.4.1",
    "eslint-plugin-jsx-a11y": "^6.4.1",
    "eslint-plugin-no-null": "^1.0.2",
    "eslint-plugin-prefer-arrow": "^1.2.3",
    "eslint-plugin-prettier": "^3.4.0",
    "eslint-plugin-promise": "^5.1.0",
    "eslint-plugin-react": "^7.21.5",
    "eslint-plugin-react-hooks": "^4.2.0",
    "eslint-plugin-unicorn": "^34.0.1",
    "express-jwt": "^5.3.3",
    "glob": "^7.2.0",
    "husky": "^7.0.1",
    "jest": "27.2.3",
    "jest-canvas-mock": "^2.3.1",
    "jest-junit": "^12.2.0",
    "jest-preset-angular": "11.0.1",
    "jest-reporter": "^1.0.1",
    "jest-when": "^3.3.1",
    "jsverify": "^0.8.4",
    "lint-staged": "^11.1.2",
    "node-mocks-http": "^1.10.1",
    "prettier": "^2.3.2",
    "stylelint": "^13.13.1",
    "stylelint-config-recommended": "^5.0.0",
    "stylelint-scss": "^3.19.0",
    "ts-jest": "27.0.5",
    "typescript": "4.4.4",
    "webpack": "^5.47.0",
    "webpack-bundle-analyzer": "^4.4.2",
    "webpack-merge": "^5.8.0",
    "webpack-node-externals": "^3.0.0"
  },
  "cypress-cucumber-preprocessor": {
    "nonGlobalStepDefinitions": true,
    "stepDefinitions": "src/integration",
    "cucumberJson": {
      "generate": true,
      "outputFolder": "../../reports/cucumber",
      "fileSuffix": ".cucumber"
    }
  }
}
sibijohn72 commented 2 years ago

i had the same problem after i had to change the name of an existing internal package. it would keep breaking with this error till i ran nx clear-cache

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.