Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot find module '@angular-devkit/core' after creating a brand new workspace #42

Closed
imjulianeral opened this issue Jun 17, 2021 · 2 comments

Comments

@imjulianeral
Copy link

Hi @beeman! Hope you're doing well. I got the following error after executing npx nx g @nx-go/nx-go:app api in a brand new workspace:

Cannot find module '@angular-devkit/core'
Require stack:
- /home/imjulian/go-playground/node_modules/@nrwl/tao/src/commands/ngcli-adapter.js
- /home/imjulian/go-playground/node_modules/@nrwl/tao/src/commands/generate.js
- /home/imjulian/go-playground/node_modules/@nrwl/tao/index.js
- /home/imjulian/go-playground/node_modules/@nrwl/cli/lib/init-local.js
- /home/imjulian/go-playground/node_modules/@nrwl/cli/bin/nx.js

It's a strange error because I followed all the steps defined in the README.md file, so there are no angular dependencies in my workspace, I tried to install the module anyway but I got the same error with another angular dependency:

Cannot find module '@angular-devkit/schematics/tools'
Require stack:
- /home/imjulian/go-playground/node_modules/@nrwl/tao/src/commands/ngcli-adapter.js
- /home/imjulian/go-playground/node_modules/@nrwl/tao/src/commands/generate.js
- /home/imjulian/go-playground/node_modules/@nrwl/tao/index.js
- /home/imjulian/go-playground/node_modules/@nrwl/cli/lib/init-local.js
- /home/imjulian/go-playground/node_modules/@nrwl/cli/bin/nx.js

I also tried to install it, but I got this error:

npm ERR! code ENOLOCAL
npm ERR! Could not install from "@angular-devkit/schematics/tools" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/imjulian/.npm/_logs/2021-06-17T16_51_23_101Z-debug.log

Thanks a lot for your attention in advance. All the best :D

@toverux
Copy link

toverux commented Jun 17, 2021

I encountered this problem too when installing this library today. The problem is that these builders actually do depend from @angular-devkit. Those are Angular CLI builders and not just simple Nx executors. I don't exactly know why the author chose to implement it like this (maybe it's legacy from the time Nx was much more tied to Angular, but I'm not sure since that's the first time I setup a Nx project).
I fixed it by creating an Angular app... because I needed it anyway.

But you should be able to install those dependencies without setting up a full Angular application.

I also tried to install it, but I got this error:

Did you use something like: npm i @angular-devkit/schematics/tools?
If yes, the error is to be expected, it is not a valid package name. Try installing @angular-devkit/schematics instead.

@imjulianeral
Copy link
Author

Thanks a lot! npm i @angular-devkit/schematics solved my problem. Thanks for being so kind and fast to respond. Hope this issue could be fixed in the next version, in a patch or something.

Have a great day! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants