bennymeg / nx-electron

Electron schematics for nrwl nx platform
Apache License 2.0
328 stars 85 forks source link

fileutils_1.readJsonFile is not a function #158

Closed yhornik closed 2 years ago

yhornik commented 2 years ago

Hi I am a beginner in nx and nx-electron. I followed how to create workspace with angular app and also add electron project. When I run nx build grace-vs2 ==> error fileutils_1.readJsonFile is not a function Can you tell me what was wrong ? This is the detail: fileutils_1.readJsonFile is not a function TypeError: fileutils_1.readJsonFile is not a function at Object.generatePackageJson (/Users/yustinahornik/Documents/Electron-projects/biologic-vs2/node_modules/nx-electron/src/utils/generate-package-json.js:32:41) at executor (/Users/yustinahornik/Documents/Electron-projects/biologic-vs2/node_modules/nx-electron/src/executors/build/executor.js:31:33) at /Users/yustinahornik/Documents/Electron-projects/biologic-vs2/node_modules/@nrwl/tao/src/commands/run.js:144:23 at Generator.next () at /Users/yustinahornik/Documents/Electron-projects/biologic-vs2/node_modules/tslib/tslib.js:118:75 at new Promise () at __awaiter (/Users/yustinahornik/Documents/Electron-projects/biologic-vs2/node_modules/tslib/tslib.js:114:16) at runExecutorInternal (/Users/yustinahornik/Documents/Electron-projects/biologic-vs2/node_modules/@nrwl/tao/src/commands/run.js:124:34) at Object. (/Users/yustinahornik/Documents/Electron-projects/biologic-vs2/node_modules/@nrwl/tao/src/commands/run.js:216:54) at Generator.next ()

yhornik commented 2 years ago

package.json (part) "scripts": { "ng": "nx", "postinstall": "node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main", "start": "nx serve", "build": "nx build", "test": "nx test" }, "private": true, "dependencies": { "@angular/animations": "~13.1.0", "@angular/common": "~13.1.0", "@angular/compiler": "~13.1.0", "@angular/core": "~13.1.0", "@angular/forms": "~13.1.0", "@angular/platform-browser": "~13.1.0", "@angular/platform-browser-dynamic": "~13.1.0", "@angular/router": "~13.1.0", "@nrwl/angular": "13.4.3", "rxjs": "~7.4.0", "tslib": "^2.0.0", "zone.js": "~0.11.4" }, "devDependencies": { "@angular-devkit/build-angular": "~13.1.0", "@angular-eslint/eslint-plugin": "~13.0.1", "@angular-eslint/eslint-plugin-template": "~13.0.1", "@angular-eslint/template-parser": "~13.0.1", "@angular/cli": "~13.1.0", "@angular/compiler-cli": "~13.1.0", "@angular/language-service": "~13.1.0", "@nrwl/cli": "13.4.3", "@nrwl/cypress": "13.4.3", "@nrwl/eslint-plugin-nx": "13.4.3", "@nrwl/jest": "13.4.3", "@nrwl/linter": "13.4.3", "@nrwl/tao": "13.4.3", "@nrwl/workspace": "13.4.3", "@types/jest": "27.0.2", "@types/node": "14.14.33", "@typescript-eslint/eslint-plugin": "~5.3.0", "@typescript-eslint/parser": "~5.3.0", "cypress": "^9.1.0", "electron": "^17.0.0", "eslint": "8.2.0", "eslint-config-prettier": "8.1.0", "eslint-plugin-cypress": "^2.10.3", "exitzero": "^1.0.1", "jest": "27.2.3", "jest-preset-angular": "11.0.0", "nx-electron": "^12.1.0", "prettier": "^2.3.1", "ts-jest": "27.0.5", "typescript": "~4.4.3" }

paustint commented 2 years ago

I also ran into this yesterday - looks like this library only supports nx up to version 12 - see https://github.com/bennymeg/nx-electron/issues/120

bennymeg commented 2 years ago

You need to match NX version to NX-ELECTRON version. You can use the latest beta version, it is stable.

paustint commented 2 years ago

@bennymeg - Any ETA for nx version 14? Will nx-electron 13.x work with 14.x? Seems like react router and react testing library had some breaking changes, but not sure if there are any other library level changes that would be incompatible.

https://github.com/nrwl/nx/releases/tag/14.0.0

yhornik commented 2 years ago

@bennymeg - I've tried using electron ^17.0.0, nx-electron 13.0.0-beta.1 and @nrwl/angular 13.4.3 ... without adding any new code, and run angular app and electron, it works. Thx