nrwl / nx

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

nx migrate Cannot find module @angular-devkit/architect #4636

Closed Benny739 closed 3 years ago

Benny739 commented 3 years ago

I'm trying to migrate from 11.0 to 11.2.

I'm getting following error:

Running migration rename-workspace-schematic-script
Cannot find module '@angular-devkit/architect'
Require stack:
- /private/var/folders/qg/mf99k0fs14g8sptzqrsp0_nr0000gn/T/tmp-5948XY2ZBOgXzEfX/node_modules/@nrwl/tao/src/commands/ngcli-adapter.js
- /private/var/folders/qg/mf99k0fs14g8sptzqrsp0_nr0000gn/T/tmp-5948XY2ZBOgXzEfX/node_modules/@nrwl/tao/src/commands/migrate.js
- /private/var/folders/qg/mf99k0fs14g8sptzqrsp0_nr0000gn/T/tmp-5948XY2ZBOgXzEfX/node_modules/@nrwl/tao/index.js
Command failed: /var/folders/qg/mf99k0fs14g8sptzqrsp0_nr0000gn/T/tmp-5948XY2ZBOgXzEfX/node_modules/.bin/tao migrate --run-migrations=migrations.json

I tried to add the package to the dev dependencies, but it did not change anything.

Environment:

Node : 14.15.4
  OS   : darwin x64
  npm  : 6.14.11

  nx : Not Found
  @nrwl/angular : 11.2.0
  @nrwl/cli : 11.2.0
  @nrwl/cypress : 11.2.0
  @nrwl/devkit : 11.2.0
  @nrwl/eslint-plugin-nx : Not Found
  @nrwl/express : Not Found
  @nrwl/jest : 11.2.0
  @nrwl/linter : 11.2.0
  @nrwl/nest : 11.2.0
  @nrwl/next : Not Found
  @nrwl/node : 11.2.0
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 11.2.0
  @nrwl/web : Not Found
  @nrwl/workspace : 11.2.0
  typescript : 4.0.5
haskelcurry commented 3 years ago

I'm experiencing the same problem

veganeveloper commented 3 years ago

You should know I'm experiencing the same problem too. btw, in case someone is curious, I'm vegan!

FrozenPandaz commented 3 years ago

This should be fixed in version 11.2.5 please try again with that version.

pmenze commented 3 years ago

In my nx 10 workspace I have some custom builders that depend on '@angular-devkit/architect'. After migration to nx 11.2.6 they do not work anymore, the package '@angular-devkit/architect' has disappeared. Is this an error or is '@angular-devkit/architect' no longer supported? Is it neccessary to manually migrate to Nx executors now?

duard commented 3 years ago

I'm experiencing the same problem

npx create-nx-workspace of5 
npm install -g @nrwl/schematics
npm install -g nx
npm install -D @nrwl/angular

image

github-actions[bot] commented 3 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! πŸ™

FrozenPandaz commented 3 years ago

@pmenze @duard those issues should be resolved in the latest version of Nx. Can you please retest with the latest version?

noviadi commented 3 years ago

I think it was fixed but the issue occurs again.

@FrozenPandaz bumping this issue because in latest version 11.4.0 the dependencies for @angular-devkit/architect were removed once again in this commit.

duard commented 3 years ago

@FrozenPandaz I fixed the problem doing this

npx create-nx-workspace of5
npm install -g @nrwl/schematics
npm install -g nx
npm install -D @nrwl/angular
npm install --save-dev @angular-devkit/architect
npm install -D @nrwl/nest
github-actions[bot] commented 3 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! πŸ™

dgsmith2 commented 3 years ago

I hit this today migrating from 11.2.12 to 11.5.2. Any updates @FrozenPandaz and @vsavkin?

It ran fine after migrating, but that is because it still existed in node_modules. However, once clearing it out I encountered the failure. Should the dependency be restored in the commit mentioned by @noviadi, or do developers need to manually added it to their project?

Krotau commented 3 years ago

I am also encountering this problem after migration failed so I deleted node_modules folder and ran npm install again. I hope this gets fixed, adding an possible unwanted dependency should not be a thing when using NX.

github-actions[bot] commented 3 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! πŸ™

stingrigs commented 3 years ago

I woulder why @angular-devkit/architect is a dependency for my project since I haven't use angular, I'm using react!

ThilinaPrasad commented 3 years ago

Resolved this with below npm installation npm install --save-dev @angular-devkit/architect

github-actions[bot] commented 3 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! πŸ™

lukasgeiter commented 3 years ago

I'm having a similar issue with latest Nx version (12.3.4). In my case the error comes up when trying to run the @nrwl/react-native:start builder:

Cannot find module '@angular-devkit/architect'
Require stack:
- \node_modules\@nrwl\tao\src\commands\ngcli-adapter.js
- \node_modules\@nrwl\tao\src\commands\run.js
- \node_modules\@nrwl\tao\index.js
- \node_modules\@nrwl\cli\lib\run-cli.js

As far as I can tell, the root cause of the error is that @nrwl/tao uses @angular-devkit/architect without declaring it as dependency. The code that imports @angular-devkit/architect is located in ngcli-adapter.ts:

https://github.com/nrwl/nx/blob/c71137f34cd687f6b38b96d60c9b7b17deacdf17/packages/tao/src/commands/ngcli-adapter.ts#L39-L43

github-actions[bot] commented 3 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! πŸ™

lukasgeiter commented 3 years ago

Leaving a comment to keep the issue alive. @FrozenPandaz could you take another look at this?

billyjov commented 3 years ago

Same issue here with v12

github-actions[bot] commented 3 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! πŸ™

kevinolivar commented 3 years ago

Hi there,

getting this issue as well.

> nx run nre-web:stylelint 
Cannot find module '@angular-devkit/architect'
Require stack:
- /node_modules/nx-stylelint/node_modules/@nrwl/devkit/src/utils/convert-nx-executor.js
- /node_modules/nx-stylelint/node_modules/@nrwl/devkit/index.js
- /node_modules/nx-stylelint/src/executors/lint/executor.js
- /node_modules/@nrwl/tao/src/shared/workspace.js
- /node_modules/@nrwl/tao/src/commands/run.js
- /node_modules/@nrwl/tao/index.js
- /node_modules/@nrwl/cli/lib/run-cli.js

Environment

"@nrwl/cli": "12.5.7",
"@nrwl/cypress": "12.5.7",
"@nrwl/eslint-plugin-nx": "12.5.7",
"@nrwl/express": "12.5.7",
"@nrwl/jest": "12.5.7",
"@nrwl/linter": "12.5.7",
"@nrwl/next": "12.5.7",
"@nrwl/node": "12.5.7",
"@nrwl/react": "12.5.7",
"@nrwl/storybook": "12.5.7",
"@nrwl/tao": "12.5.7",
"@nrwl/web": "12.5.7",
"@nrwl/workspace": "12.5.7",

This happened after upgrading nx-stylelint to latest though,

 "nx-stylelint": "^12.1.0",
github-actions[bot] commented 3 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! πŸ™

KeKs0r commented 3 years ago

The obligatory additional comment to make this issue not stale anymore, since I am also running into it. Version I just migrated to is 11.6.3

lukasgeiter commented 3 years ago

For anyone having this issue with react native: I was able to resolve it by updating @nrwl/react-native to version 12.x

rickvandermey commented 3 years ago

EDIT: Fixed Can confirm its still a thing

its working locally. in the pipeline i get errors on my karma/jasmine unit test

Jest apps do work.

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / β–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

Angular CLI: 12.2.1
Node: 14.16.1
Package Manager: npm 7.21.0
OS: darwin x64

Angular: 12.2.1
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1202.2
@angular-devkit/build-angular   12.1.4
@angular-devkit/core            12.2.2
@angular-devkit/schematics      12.2.1
@nguniversal/common             12.1.0
@nguniversal/express-engine     12.1.0
@schematics/angular             12.2.1
rxjs                            6.6.7
typescript                      4.3.5

dependencies

        "@nrwl/angular": "12.7.1",
        "@nrwl/nx-cloud": "12.3.10",

devDependencies

        "@nrwl/cli": "12.7.1",
        "@nrwl/eslint-plugin-nx": "12.7.1",
        "@nrwl/express": "12.7.1",
        "@nrwl/jest": "12.7.1",
        "@nrwl/linter": "12.7.1",
        "@nrwl/storybook": "12.7.1",
        "@nrwl/tao": "12.7.1",
        "@nrwl/workspace": "12.7.1",

Update on my issue*: @angular-devkit/architect 0.1202.2 is installed because of the @angular-devkit/build-angular 12.1.4 and/or @angular/cli, but because it is not in the package json, nx-cloud is throwing errors. Installing it as explicit devDependency fixxes my problem

github-actions[bot] commented 3 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! πŸ™

suryacyg commented 3 years ago

I still get this error with fresh install of nx angular mfe

`surya@Suryas-Mac veronica % npm run start --verbose npm verb cli [ npm verb cli '/Users/surya/.nvm/versions/node/v16.9.1/bin/node', npm verb cli '/Users/surya/.nvm/versions/node/v16.9.1/bin/npm', npm verb cli 'run', npm verb cli 'start', npm verb cli '--verbose' npm verb cli ] npm info using npm@7.21.1 npm info using node@v16.9.1 npm timing npm:load:whichnode Completed in 0ms npm timing config:load:defaults Completed in 1ms npm timing config:load:file:/Users/surya/.nvm/versions/node/v16.9.1/lib/node_modules/npm/npmrc Completed in 1ms npm timing config:load:builtin Completed in 1ms npm timing config:load:cli Completed in 2ms npm timing config:load:env Completed in 1ms npm timing config:load:file:/Users/surya/code/seneca-global/sg-auth/web/veronica/.npmrc Completed in 0ms npm timing config:load:project Completed in 3ms npm timing config:load:file:/Users/surya/.npmrc Completed in 1ms npm timing config:load:user Completed in 1ms npm timing config:load:file:/Users/surya/.nvm/versions/node/v16.9.1/etc/npmrc Completed in 0ms npm timing config:load:global Completed in 1ms npm timing config:load:validate Completed in 0ms npm timing config:load:credentials Completed in 1ms npm timing config:load:setEnvs Completed in 1ms npm timing config:load Completed in 12ms npm timing npm:load:configload Completed in 12ms npm timing npm:load:setTitle Completed in 19ms npm timing npm:load:setupLog Completed in 1ms npm timing config:load:flatten Completed in 2ms npm timing npm:load:cleanupLog Completed in 2ms npm timing npm:load:configScope Completed in 0ms npm timing npm:load:projectScope Completed in 1ms npm timing npm:load Completed in 44ms

veronica@0.0.0 start nx serve

βΈ¨β ‚β ‚β ‚β ‚β ‚β ‚β ‚β ‚β ‚β ‚β ‚β ‚β ‚β ‚β ‚β ‚β ‚β ‚βΈ© β § : timing npm:load Completed in 44ms

nx run shell:serve:development Cannot find module '@angular-devkit/architect'eted in 44ms Require stack:

  • /Users/surya/code/seneca-global/sg-auth/web/node_modules/@nrwl/angular/src/builders/webpack-server/webpack-server.impl.js
  • /Users/surya/code/seneca-global/sg-auth/web/veronica/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js
  • /Users/surya/code/seneca-global/sg-auth/web/veronica/node_modules/@angular-devkit/architect/node/index.js
  • /Users/surya/code/seneca-global/sg-auth/web/veronica/node_modules/@nrwl/tao/src/commands/ngcli-adapter.js
  • /Users/surya/code/seneca-global/sg-auth/web/veronica/node_modules/@nrwl/tao/src/commands/run.js
  • /Users/surya/code/seneca-global/sg-auth/web/veronica/node_modules/@nrwl/tao/index.js
  • /Users/surya/code/seneca-global/sg-auth/web/veronica/node_modules/@nrwl/cli/lib/run-cli.js

β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

NX ERROR Running target "shell:serve" failed

Failed tasks:

github-actions[bot] commented 3 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! πŸ™

webhelyhu commented 3 years ago

EDIT: For me, the problem was that the @angular-devkit/architect's init has not been fired automatically (I do not know if t needs to start automatically, or the problem was that the package was alread installed globally). So I had to execute: nx g @nrwl/angular:init After this, it worked.

Same issue here, when following official nx mfe guide (https://nx.dev/l/a/guides/setup-mfe-with-angular)

nx run login:serve:development Cannot find module '@angular-devkit/architect' Require stack:

  • C:\node14\node_modules\@nrwl\angular\src\builders\webpack-server\webpack-server.impl.js
  • C:\node14\nx13mfe\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
  • C:\node14\nx13mfe\node_modules\@angular-devkit\architect\node\index.js
  • C:\node14\nx13mfe\node_modules\@nrwl\tao\src\commands\ngcli-adapter.js
  • C:\node14\nx13mfe\node_modules\@nrwl\tao\src\commands\run.js
  • C:\node14\nx13mfe\node_modules\@nrwl\tao\index.js
  • C:\node14\nx13mfe\node_modules\@nrwl\cli\lib\run-cli.js
kszlachetka commented 1 year ago

This still happens in 15.0.0 while I'm trying to run e2e tests with @nrwl/cypress leveraging a library built with @nrwl/js:tsc

Error: Build failed with 19 errors:
../../node_modules/.pnpm/@nrwl+devkit@15.0.0_nx@15.0.0+typescript@4.8.4/node_modules/@nrwl/devkit/src/utils/convert-nx-executor.js:40:19: ERROR: Could not resolve "@angular-devkit/architect"
../../node_modules/.pnpm/nx@15.0.0/node_modules/nx/src/adapter/ngcli-adapter.js:6:23: ERROR: Could not resolve "@angular-devkit/core"
../../node_modules/.pnpm/nx@15.0.0/node_modules/nx/src/adapter/ngcli-adapter.js:8:23: ERROR: Could not resolve "@angular-devkit/core/node"
../../node_modules/.pnpm/nx@15.0.0/node_modules/nx/src/adapter/ngcli-adapter.js:21:38: ERROR: Could not resolve "@angular-devkit/architect"
../../node_modules/.pnpm/nx@15.0.0/node_modules/nx/src/adapter/ngcli-adapter.js:22:63: ERROR: Could not resolve "@angular-devkit/architect/node"
...

package.json:

    "@nrwl/cli": "15.0.0",
    "@nrwl/cypress": "15.0.0",
    "@nrwl/devkit": "15.0.0",
    "@nrwl/js": "15.0.0",
    "@nrwl/workspace": "15.0.0",
    "nx": "15.0.0"

Project is not an Angular application.

Krasnov8953 commented 1 year ago

It still happends in 15.2.1

nx run admin-dashboard:serve

 >  NX   Cannot find module '@angular-devkit/architect'

   Require stack:
   - C:\Users\vkrasnov\c4\www\frontend\node_modules\nx\src\adapter\ngcli-adapter.js
   - C:\Users\vkrasnov\c4\www\frontend\node_modules\nx\src\command-line\run.js
   - C:\Users\vkrasnov\c4\www\frontend\node_modules\nx\bin\run-executor.js
   Pass --verbose to see the stacktrace.

nx report

   Node : 16.16.0
   OS   : win32 x64
   npm  : 8.11.0

   nx : 15.2.1
   @nrwl/angular : 15.2.1
   @nrwl/cypress : 15.2.1
   @nrwl/detox : Not Found
   @nrwl/devkit : 15.2.1
   @nrwl/esbuild : Not Found
   @nrwl/eslint-plugin-nx : 15.2.1
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 15.2.1
   @nrwl/js : 15.2.1
   @nrwl/linter : 15.2.1
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/rollup : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 15.2.1
   @nrwl/web : Not Found
   @nrwl/webpack : 15.2.1
   @nrwl/workspace : 15.2.1
   typescript : 4.8.4
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:
         @ngrx/effects: 15.0.0
         @ngrx/store: 15.0.0
         @ngrx/store-devtools: 15.0.0

after installing @angular-devkit/architect as dependcy, nx serve failing with this errror Cannot read properties of undefined (reading 'tsConfig') but tsConfig is in right place regarding schema of project.json as executor I using @nrwl/angular:webpack-dev-server

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.