nrwl / nx-workshop

Companion labs for the workshop: "Develop at Scale with Nx Monorepos"
174 stars 119 forks source link

lab3 migrations fails #94

Closed mhamri closed 1 year ago

mhamri commented 1 year ago

content of migrations.json

{
  "migrations": [
    {
      "version": "0.1.1",
      "description": "Complete Lab 1",
      "cli": "nx",
      "implementation": "./src/migrations/complete-lab-1/complete-lab-1",
      "package": "@nrwl/nx-workshop",
      "name": "complete-lab-1"
    },
    {
      "version": "0.1.2",
      "description": "Complete Lab 2",
      "cli": "nx",
      "implementation": "./src/migrations/complete-lab-2/complete-lab-2",
      "package": "@nrwl/nx-workshop",
      "name": "complete-lab-2"
    },
    {
      "version": "0.1.3",
      "description": "Complete Lab 3",
      "cli": "nx",
      "implementation": "./src/migrations/complete-lab-3/complete-lab-3",
      "package": "@nrwl/nx-workshop",
      "name": "complete-lab-3"
    }
  ]
}

and this is the error

PS C:\repo\toDelete\bg-hoard-raw-apps> ls   

    Directory: C:\repo\toDelete\bg-hoard-raw-apps

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----          3/9/2023  12:52 PM                .angular
d-----          3/9/2023  12:23 PM                .vscode
d-----          3/3/2023   1:00 PM                apps
d-----          3/9/2023  12:59 PM                dist
d-----          3/3/2023  12:44 PM                libs
d-----          3/9/2023   1:46 PM                node_modules
d-----          3/3/2023  12:44 PM                tools
-a----          3/3/2023  12:44 PM            245 .editorconfig
-a----          3/9/2023  12:36 PM             13 .eslintignore
-a----          3/9/2023  12:36 PM            900 .eslintrc.json
-a----          3/9/2023  12:36 PM            549 .gitignore
-a----          3/3/2023  12:44 PM             74 .prettierignore
-a----          3/3/2023  12:44 PM             26 .prettierrc
-a----          3/9/2023  12:36 PM             98 jest.config.ts
-a----          3/9/2023  12:36 PM             90 jest.preset.js
-a----          3/9/2023   1:38 PM            745 migrations.json
-a----          3/9/2023  12:36 PM           1436 nx.json
-a----          3/9/2023   1:46 PM        1002128 package-lock.json
-a----          3/9/2023   1:36 PM           1811 package.json
-a----          3/3/2023  12:44 PM            594 README.md
-a----          3/9/2023  12:36 PM            467 tsconfig.base.json

PS C:\repo\toDelete\bg-hoard-raw-apps> cd apps
PS C:\repo\toDelete\bg-hoard-raw-apps\apps> ls

    Directory: C:\repo\toDelete\bg-hoard-raw-apps\apps

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----          3/9/2023  12:36 PM                store
d-----          3/9/2023  12:36 PM                store-e2e
-a----          3/3/2023  12:44 PM              0 .gitkeep

PS C:\repo\toDelete\bg-hoard-raw-apps\apps> cd ..
PS C:\repo\toDelete\bg-hoard-raw-apps> npx nx migrate --run-migrations

 >  NX   Running 'npm install' to make sure necessary packages are installed

up to date, audited 1864 packages in 4s

184 packages are looking for funding
  run `npm fund` for details

2 critical severity vulnerabilities

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

 >  NX   Running migrations from 'migrations.json'

You have passed --forceRemove
You have passed --forceRemove
C:\repo\toDelete\bg-hoard-raw-apps\node_modules\@nrwl\nx-workshop\node_modules\nx\src\generators\utils\json.js:14
        throw new Error(`Cannot find ${path}`);
              ^

Error: Cannot find apps\store-e2e\project.json
    at readJson (C:\repo\toDelete\bg-hoard-raw-apps\node_modules\@nrwl\nx-workshop\node_modules\nx\src\generators\utils\json.js:14:15)
    at C:\repo\toDelete\bg-hoard-raw-apps\node_modules\@nrwl\nx-workshop\node_modules\nx\src\generators\utils\project-configuration.js:120:119
    at buildProjectsConfigurationsFromGlobs (C:\repo\toDelete\bg-hoard-raw-apps\node_modules\@nrwl\nx-workshop\node_modules\nx\src\config\workspaces.js:473:35)
    at readAndCombineAllProjectConfigurations (C:\repo\toDelete\bg-hoard-raw-apps\node_modules\@nrwl\nx-workshop\node_modules\nx\src\generators\utils\project-configuration.js:120:66)
    at getProjects (C:\repo\toDelete\bg-hoard-raw-apps\node_modules\@nrwl\nx-workshop\node_modules\nx\src\generators\utils\project-configuration.js:99:23)
    at removeProjectReferencesInConfig (C:\repo\toDelete\bg-hoard-raw-apps\node_modules\@nrwl\nx-workshop\node_modules\@nrwl\workspace\src\generators\remove\lib\remove-project-references-in-config.js:13:30)    
    at C:\repo\toDelete\bg-hoard-raw-apps\node_modules\@nrwl\nx-workshop\node_modules\@nrwl\workspace\src\generators\remove\remove.js:20:83
    at Generator.next (<anonymous>)
    at fulfilled (C:\repo\toDelete\bg-hoard-raw-apps\node_modules\tslib\tslib.js:164:62)

Node.js v18.14.2
Command failed: npx nx _migrate --run-migrations

 >  NX   Command failed: npx nx migrate --run-migrations

   Pass --verbose to see the stacktrace.

PS C:\repo\toDelete\bg-hoard-raw-apps> cd .\apps\store-e2e\
PS C:\repo\toDelete\bg-hoard-raw-apps\apps\store-e2e> ls

    Directory: C:\repo\toDelete\bg-hoard-raw-apps\apps\store-e2e

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----          3/3/2023   1:00 PM                src
-a----          3/9/2023  12:36 PM            364 .eslintrc.json
-a----          3/9/2023  12:36 PM            174 cypress.config.ts
-a----          3/9/2023  12:36 PM            781 project.json
-a----          3/9/2023  12:36 PM            657 tsconfig.json
meeroslav commented 1 year ago

Please try with the latest version. It should be fixed now.

mhamri commented 1 year ago

@meeroslav unfortunately it doesn't work with latest version

PS C:\repo\toDelete\ngrx-nx-workshop\lab1-1> nx g @nrwl/nx-workshop:complete-labs --to 3

>  NX  Generating @nrwl/nx-workshop:complete-labs

Migration file generated, to complete the labs run:
nx migrate --run-migrations=migrations.json
UPDATE migrations.json
PS C:\repo\toDelete\ngrx-nx-workshop\lab1-1> nx migrate --run-migrations

 >  NX   Running 'pnpm install --no-frozen-lockfile' to make sure necessary packages are installed

Lockfile is up to date, resolution step is skipped
Already up to date
Done in 2.2s

 >  NX   Running migrations from 'migrations.json'

 >  NX   Failed to run complete-lab-2 from @nrwl/nx-workshop. This workspace is NOT up to date!

 >  NX   Cannot find module 'nx/src/lock-file/lock-file'

   Require stack:
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+js@15.8.6_eslint@8.46.0_nx@16.9.1_prettier@2.8.8_typescript@4.9.5\node_modules\@nrwl\js\src\utils\package-json\update-package-json.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+js@15.8.6_eslint@8.46.0_nx@16.9.1_prettier@2.8.8_typescript@4.9.5\node_modules\@nrwl\js\src\utils\package-json\index.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+js@15.8.6_eslint@8.46.0_nx@16.9.1_prettier@2.8.8_typescript@4.9.5\node_modules\@nrwl\js\src\index.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+cypress@15.8.6_cypress@13.2.0_eslint@8.46.0_nx@16.9.1_prettier@2.8.8_typescript@4.9.5\node_modules\@nrwl\cypress\src\generators\cypress-project\cypress-project.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+cypress@15.8.6_cypress@13.2.0_eslint@8.46.0_nx@16.9.1_prettier@2.8.8_typescript@4.9.5\node_modules\@nrwl\cypress\index.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+angular@15.8.6_@angular-devkit+build-angular@16.2.3_@angular-devkit+core@16.2.3_@angula_oyd65brvl3osw4mo4aigwalqwy\node_modules\@nrwl\angular\src\generators\init\init.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+angular@15.8.6_@angular-devkit+build-angular@16.2.3_@angular-devkit+core@16.2.3_@angula_oyd65brvl3osw4mo4aigwalqwy\node_modules\@nrwl\angular\src\generators\application\application.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+angular@15.8.6_@angular-devkit+build-angular@16.2.3_@angular-devkit+core@16.2.3_@angula_oyd65brvl3osw4mo4aigwalqwy\node_modules\@nrwl\angular\generators.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+nx-workshop@0.4.11_@angular-devkit+build-angular@16.2.3_@angular-devkit+core@16.2.3_@an_gzbq26idpzvvdyw2dxkthcyxge\node_modules\@nrwl\nx-workshop\src\migrations\complete-lab-2\complete-lab-2.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\nx@16.9.1\node_modules\nx\src\command-line\migrate\migrate.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\nx@16.9.1\node_modules\nx\src\command-line\migrate\command-object.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\nx@16.9.1\node_modules\nx\src\command-line\nx-commands.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\nx@16.9.1\node_modules\nx\bin\init-local.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\nx@16.9.1\node_modules\nx\bin\nx.js
   Pass --verbose to see the stacktrace.

Command failed: pnpm exec nx _migrate --run-migrations

 >  NX   Command failed: pnpm exec nx migrate --run-migrations

   Pass --verbose to see the stacktrace.

Command failed: C:\Users\amrim\AppData\Local\Temp\tmp-27612-Faj8SxACX5Qz\node_modules\.bin\nx _migrate --run-migrations

PS C:\repo\toDelete\ngrx-nx-workshop\lab1-1> nx migrate --run-migrations --verbose

 >  NX   Running 'pnpm install --no-frozen-lockfile' to make sure necessary packages are installed

Lockfile is up to date, resolution step is skipped
Already up to date
Done in 2.1s

 >  NX   Running migrations from 'migrations.json'

 >  NX   Failed to run complete-lab-2 from @nrwl/nx-workshop. This workspace is NOT up to date!

 >  NX   Cannot find module 'nx/src/lock-file/lock-file'

   Require stack:
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+js@15.8.6_eslint@8.46.0_nx@16.9.1_prettier@2.8.8_typescript@4.9.5\node_modules\@nrwl\js\src\utils\package-json\update-package-json.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+js@15.8.6_eslint@8.46.0_nx@16.9.1_prettier@2.8.8_typescript@4.9.5\node_modules\@nrwl\js\src\utils\package-json\index.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+js@15.8.6_eslint@8.46.0_nx@16.9.1_prettier@2.8.8_typescript@4.9.5\node_modules\@nrwl\js\src\index.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+cypress@15.8.6_cypress@13.2.0_eslint@8.46.0_nx@16.9.1_prettier@2.8.8_typescript@4.9.5\node_modules\@nrwl\cypress\src\generators\cypress-project\cypress-project.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+cypress@15.8.6_cypress@13.2.0_eslint@8.46.0_nx@16.9.1_prettier@2.8.8_typescript@4.9.5\node_modules\@nrwl\cypress\index.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+angular@15.8.6_@angular-devkit+build-angular@16.2.3_@angular-devkit+core@16.2.3_@angula_oyd65brvl3osw4mo4aigwalqwy\node_modules\@nrwl\angular\src\generators\init\init.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+angular@15.8.6_@angular-devkit+build-angular@16.2.3_@angular-devkit+core@16.2.3_@angula_oyd65brvl3osw4mo4aigwalqwy\node_modules\@nrwl\angular\src\generators\application\application.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+angular@15.8.6_@angular-devkit+build-angular@16.2.3_@angular-devkit+core@16.2.3_@angula_oyd65brvl3osw4mo4aigwalqwy\node_modules\@nrwl\angular\generators.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+nx-workshop@0.4.11_@angular-devkit+build-angular@16.2.3_@angular-devkit+core@16.2.3_@an_gzbq26idpzvvdyw2dxkthcyxge\node_modules\@nrwl\nx-workshop\src\migrations\complete-lab-2\complete-lab-2.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\nx@16.9.1\node_modules\nx\src\command-line\migrate\migrate.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\nx@16.9.1\node_modules\nx\src\command-line\migrate\command-object.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\nx@16.9.1\node_modules\nx\src\command-line\nx-commands.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\nx@16.9.1\node_modules\nx\bin\init-local.js
   - C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\nx@16.9.1\node_modules\nx\bin\nx.js

Error: Cannot find module 'nx/src/lock-file/lock-file'
Require stack:
- C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+js@15.8.6_eslint@8.46.0_nx@16.9.1_prettier@2.8.8_typescript@4.9.5\node_modules\@nrwl\js\src\utils\package-json\update-package-json.js
- C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+js@15.8.6_eslint@8.46.0_nx@16.9.1_prettier@2.8.8_typescript@4.9.5\node_modules\@nrwl\js\src\utils\package-json\index.js
- C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+js@15.8.6_eslint@8.46.0_nx@16.9.1_prettier@2.8.8_typescript@4.9.5\node_modules\@nrwl\js\src\index.js
- C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+cypress@15.8.6_cypress@13.2.0_eslint@8.46.0_nx@16.9.1_prettier@2.8.8_typescript@4.9.5\node_modules\@nrwl\cypress\src\generators\cypress-project\cypress-project.js
- C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+cypress@15.8.6_cypress@13.2.0_eslint@8.46.0_nx@16.9.1_prettier@2.8.8_typescript@4.9.5\node_modules\@nrwl\cypress\index.js
- C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+angular@15.8.6_@angular-devkit+build-angular@16.2.3_@angular-devkit+core@16.2.3_@angula_oyd65brvl3osw4mo4aigwalqwy\node_modules\@nrwl\angular\src\generators\init\init.js
- C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+angular@15.8.6_@angular-devkit+build-angular@16.2.3_@angular-devkit+core@16.2.3_@angula_oyd65brvl3osw4mo4aigwalqwy\node_modules\@nrwl\angular\src\generators\application\application.js
- C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+angular@15.8.6_@angular-devkit+build-angular@16.2.3_@angular-devkit+core@16.2.3_@angula_oyd65brvl3osw4mo4aigwalqwy\node_modules\@nrwl\angular\generators.js
- C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+nx-workshop@0.4.11_@angular-devkit+build-angular@16.2.3_@angular-devkit+core@16.2.3_@an_gzbq26idpzvvdyw2dxkthcyxge\node_modules\@nrwl\nx-workshop\src\migrations\complete-lab-2\complete-lab-2.js
- C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\nx@16.9.1\node_modules\nx\src\command-line\migrate\migrate.js
- C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\nx@16.9.1\node_modules\nx\src\command-line\migrate\command-object.js
- C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\nx@16.9.1\node_modules\nx\src\command-line\nx-commands.js
- C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\nx@16.9.1\node_modules\nx\bin\init-local.js
- C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\nx@16.9.1\node_modules\nx\bin\nx.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1026:15)
    at Function.Module._load (node:internal/modules/cjs/loader:871:27)
    at Module.require (node:internal/modules/cjs/loader:1098:19)
    at require (node:internal/modules/cjs/helpers:108:18)
    at Object.<anonymous> (C:\repo\toDelete\ngrx-nx-workshop\lab1-1\node_modules\.pnpm\@nrwl+js@15.8.6_eslint@8.46.0_nx@16.9.1_prettier@2.8.8_typescript@4.9.5\node_modules\@nrwl\js\src\utils\package-json\update-package-json.js:4:21)
    at Module._compile (node:internal/modules/cjs/loader:1196:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
    at Module.load (node:internal/modules/cjs/loader:1074:32)
    at Function.Module._load (node:internal/modules/cjs/loader:909:12)
    at Module.require (node:internal/modules/cjs/loader:1098:19)
Command failed: pnpm exec nx _migrate --run-migrations --verbose

 >  NX   Command failed: pnpm exec nx migrate --run-migrations --verbose

Error: Command failed: pnpm exec nx migrate --run-migrations --verbose
    at checkExecSyncError (node:child_process:861:11)
    at execSync (node:child_process:932:15)
    at runNxSync (C:\Users\amrim\AppData\Local\Temp\tmp-18484-iWWKImxR431t\node_modules\.pnpm\nx@16.9.1\node_modules\nx\src\utils\child-process.js:25:34)
    at runMigrations (C:\Users\amrim\AppData\Local\Temp\tmp-18484-iWWKImxR431t\node_modules\.pnpm\nx@16.9.1\node_modules\nx\src\command-line\migrate\migrate.js:937:39)
    at C:\Users\amrim\AppData\Local\Temp\tmp-18484-iWWKImxR431t\node_modules\.pnpm\nx@16.9.1\node_modules\nx\src\command-line\migrate\migrate.js:1031:19
    at async handleErrors (C:\Users\amrim\AppData\Local\Temp\tmp-18484-iWWKImxR431t\node_modules\.pnpm\nx@16.9.1\node_modules\nx\src\utils\params.js:9:16)
Command failed: C:\Users\amrim\AppData\Local\Temp\tmp-18484-iWWKImxR431t\node_modules\.bin\nx _migrate --run-migrations --verbose
mhamri commented 1 year ago

I've tried the npm too, the error is same as pnpm.

meeroslav commented 1 year ago

We will have a look as soon as possible. Thank you for bringing it to our attention