bennymeg / nx-electron

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

`nx g nx-electron:app` fails with Cannot find module '@angular-devkit/core' #146

Closed nidomiro closed 2 years ago

nidomiro commented 2 years ago

Describe the bug I'm experimenting with electron but I cannot execute the generate command.

To Reproduce Steps to reproduce the behavior:

  1. setup a new repo: npx create-nx-workspace@12 nx-nextjs-electron-test
  2. select the nextjs template and use plain css. Give the app a name of MyNextApp
  3. execute npm install -D nx-electron
  4. execute nx g nx-electron:app MyElectronApp --frontendProject=my-next-app
  5. type test for the directory
  6. Then Error1 happens
  7. I tried to fix Error1 by executing npm install -D @angular-devkit/core
  8. Execute steps 4 and 5, then Error2 happens

Error1:

Cannot find module '@angular-devkit/core'
Require stack:
- <snip>/nx-nextjs-electron-test/node_modules/@nrwl/tao/src/commands/ngcli-adapter.js
- <snip>/nx-nextjs-electron-test/node_modules/@nrwl/tao/src/commands/generate.js
- <snip>/nx-nextjs-electron-test/node_modules/@nrwl/tao/index.js
- <snip>/nx-nextjs-electron-test/node_modules/@nrwl/cli/lib/init-local.js
- <snip>/nx-nextjs-electron-test/node_modules/@nrwl/cli/bin/nx.js

Error2:

Cannot find module '@angular-devkit/schematics/tools'
Require stack:
- <snip>/nx-nextjs-electron-test/node_modules/@nrwl/tao/src/commands/ngcli-adapter.js
- <snip>/nx-nextjs-electron-test/node_modules/@nrwl/tao/src/commands/generate.js
- <snip>/nx-nextjs-electron-test/node_modules/@nrwl/tao/index.js
- <snip>/nx-nextjs-electron-test/node_modules/@nrwl/cli/lib/init-local.js
- <snip>/nx-nextjs-electron-test/node_modules/@nrwl/cli/bin/nx.js

Expected behavior The command should execute without error

Desktop (please complete the following information):

Additional context

$ nx --version
12.10.1
$ node --version
v16.14.0
$ npm --version
9.3.1

package.json before step 6:

{
  "name": "nx-nextjs-electron-test",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "nx": "nx",
    "start": "nx serve",
    "build": "nx build",
    "test": "nx test"
  },
  "private": true,
  "dependencies": {
    "@nrwl/next": "12.10.1",
    "core-js": "^3.6.5",
    "next": "11.1.0",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "regenerator-runtime": "0.13.7",
    "tslib": "^2.0.0"
  },
  "devDependencies": {
    "@nrwl/cli": "12.10.1",
    "@nrwl/cypress": "12.10.1",
    "@nrwl/eslint-plugin-nx": "12.10.1",
    "@nrwl/jest": "12.10.1",
    "@nrwl/linter": "12.10.1",
    "@nrwl/react": "12.10.1",
    "@nrwl/tao": "12.10.1",
    "@nrwl/web": "12.10.1",
    "@nrwl/workspace": "12.10.1",
    "@testing-library/react": "11.2.6",
    "@testing-library/react-hooks": "7.0.1",
    "@types/jest": "27.0.2",
    "@types/node": "14.14.33",
    "@types/react": "17.0.3",
    "@types/react-dom": "17.0.3",
    "@typescript-eslint/eslint-plugin": "~4.31.1",
    "@typescript-eslint/parser": "~4.31.1",
    "babel-jest": "27.2.3",
    "cypress": "^8.3.0",
    "eslint": "7.22.0",
    "eslint-config-next": "11.1.0",
    "eslint-config-prettier": "8.1.0",
    "eslint-plugin-cypress": "^2.10.3",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jsx-a11y": "6.4.1",
    "eslint-plugin-react": "7.23.1",
    "eslint-plugin-react-hooks": "4.2.0",
    "jest": "27.2.3",
    "nx-electron": "^12.0.0",
    "prettier": "^2.3.1",
    "ts-jest": "27.0.5",
    "typescript": "~4.3.5"
  }
}
bennymeg commented 2 years ago

I am not sure it is related to this plugin, we do not use angular/devkit anymore (seems to be related to @nrwl/tao). Nevertheless, could you try installing npm install -D @angular-devkit/core@12 instead, it might fix the problem.

untoldbyte commented 2 years ago

The nx-electron plugin needs to be compatible with latest NX to resolve this issue

nalaka commented 2 years ago

Are there any plans to make the nx-electron plugin work with latest Nx (14.x)?

bennymeg commented 2 years ago

Fixed in v13.1.1