nrwl / nx

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

Migration to 14.4.2 failed, nx serve not working #11092

Closed pmosconi closed 2 years ago

pmosconi commented 2 years ago

Current Behavior

Migration fails when upgrading from nx 14.1.7 to 14.4.2 In particular, migrations "add-swc-deps" and "add-swc-deps-again" return error Cannot find module './typescript/compilation' Regardless I tried to start any application with nx serve application and it fails with error Cannot find module '@nrwl/workspace/src/utilities/buildable-libs-utils'

Expected Behavior

What is the behavior that you expect to happen? 1) Migration to complete successfully 2) Applications to start

Is this a regression? .i.e Did this used to be the behavior at one point? No

Steps to Reproduce

Can you reproduce this on https://github.com/nrwl/nx-examples? YES, even though the error for nx serve is different

If so, open a PR with your changes and link it below. PR is not applicable, se below for commands to reproduce

Failure Logs

These logs come from using https://github.com/nrwl/nx-examples repo 1) run npx nx migrate latest -> success 2) run npx nx migrate --run-migrations -> error:

Running migration add-swc-deps-again

 >  NX   Cannot find module './typescript/compilation'

   Require stack:
   - C:\Users\Paolo Mosconi\Source\Repos\nx-examples\node_modules\@nrwl\workspace\src\utilities\typescript.js
   - C:\Users\Paolo Mosconi\Source\Repos\nx-examples\node_modules\@nrwl\linter\src\generators\workspace-rules-project\workspace-rules-project.js
   - C:\Users\Paolo Mosconi\Source\Repos\nx-examples\node_modules\@nrwl\linter\src\migrations\update-14-1-9\add-swc-deps-if-needed.js
   - C:\Users\PAOLOM~1\AppData\Local\Temp\tmp-18184-ekDn0eFKHQ0I\node_modules\nx\src\command-line\migrate.js
   - C:\Users\PAOLOM~1\AppData\Local\Temp\tmp-18184-ekDn0eFKHQ0I\node_modules\nx\src\command-line\nx-commands.js
   - C:\Users\PAOLOM~1\AppData\Local\Temp\tmp-18184-ekDn0eFKHQ0I\node_modules\nx\bin\init-local.js
   - C:\Users\PAOLOM~1\AppData\Local\Temp\tmp-18184-ekDn0eFKHQ0I\node_modules\nx\bin\nx.js
   Pass --verbose to see the stacktrace.

Command failed: C:\Users\PAOLOM~1\AppData\Local\Temp\tmp-18184-ekDn0eFKHQ0I\node_modules\.bin\nx _migrate --run-migrations

3) run npx nx serve cart --> error:

> nx run cart:serve:development

 >  NX   Cannot find module './typescript/compilation'

   Require stack:
   - C:\Users\Paolo Mosconi\Source\Repos\nx-examples\node_modules\@nrwl\workspace\src\utilities\typescript.js
   - C:\Users\Paolo Mosconi\Source\Repos\nx-examples\node_modules\@nrwl\web\src\utils\web.config.js
   - C:\Users\Paolo Mosconi\Source\Repos\nx-examples\node_modules\@nrwl\web\src\utils\devserver.config.js
   - C:\Users\Paolo Mosconi\Source\Repos\nx-examples\node_modules\@nrwl\web\src\executors\dev-server\dev-server.impl.js
   - C:\Users\Paolo Mosconi\Source\Repos\nx-examples\node_modules\nx\src\config\workspaces.js
   - C:\Users\Paolo Mosconi\Source\Repos\nx-examples\node_modules\nx\src\command-line\run.js
   - C:\Users\Paolo Mosconi\Source\Repos\nx-examples\node_modules\nx\bin\run-executor.js
   Pass --verbose to see the stacktrace.

Environment

   Node : 16.13.2
   OS   : win32 x64
   yarn : 1.22.18

   nx : 14.4.2
   @nrwl/angular : 14.4.2
   @nrwl/cypress : 14.4.2
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.4.2
   @nrwl/eslint-plugin-nx : 14.4.2
   @nrwl/express : Not Found
   @nrwl/jest : 14.4.2
   @nrwl/js : 14.4.2
   @nrwl/linter : 14.4.2
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : 14.2.0
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 14.4.2
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.4.2
   @nrwl/web : 14.4.2
   @nrwl/workspace : 14.4.2
   typescript : 4.7.2
   ---------------------------------------
   Community plugins:
         @ngrx/component-store: 14.0.1
         @ngrx/effects: 14.0.1
         @ngrx/entity: 14.0.1
         @ngrx/router-store: 14.0.1
         @ngrx/store: 14.0.1
         rxjs: 6.5.5
         @ngrx/store-devtools: 14.0.1

(node:18624) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at C:\Users\Paolo Mosconi\Source\Repos\nx-examples\node_modules\tslib\package.json.     
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
gerardcastell commented 2 years ago

Hi there! My team has faced the same issue, we found out that commenting the module unlocks the septup phase and the compilation succeed, then if we uncomment the module it succeeds! So it seems that there is a problem with the compilation. Any idea about this? thanks!

meeroslav commented 2 years ago

Hi, @gerardcastell and @pmosconi,

Thank you for reporting this. Can you try migrating to the latest version? Does it also break?

gerardcastell commented 2 years ago

Hi @meeroslav , I couldn't try it yet but I am pretty sure it is strongly related with this issue, hence it is likely fixed!

meeroslav commented 2 years ago

I tried migrating nx-examples from version 14.0.5 (commit: https://github.com/nrwl/nx-examples/commit/62bd0077527c2b14be5b3a75bb95e8219aee8ce3) to 14.4.2 which includes the above mentioned add-swc-deps-again migration.

I could not reproduce the migration or serve error.

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.