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

Cannot find module '@angular-devkit/schematics' - on NEW nextjs app #4857

Closed
iangregsondev opened this issue Feb 22, 2021 · 8 comments
Closed

Comments

@iangregsondev
Copy link

Current Behavior

running yarn build, I get the error below, its a brand new workspace created like so and choosing nextjs

npx create-nx-workspace@latest --packageManager=yarn
Cannot find module '@angular-devkit/schematics'
Require stack:
- /Users/ian/Development/Work/shotgun-web/node_modules/@nrwl/workspace/src/utils/ast-utils.js
- /Users/ian/Development/Work/shotgun-web/node_modules/@nrwl/workspace/src/utils/project-type.js
- /Users/ian/Development/Work/shotgun-web/node_modules/@nrwl/workspace/index.js
- /Users/ian/Development/Work/shotgun-web/node_modules/@nrwl/next/src/builders/build/lib/create-package-json.js
- /Users/ian/Development/Work/shotgun-web/node_modules/@nrwl/next/src/builders/build/build.impl.js
- /Users/ian/Development/Work/shotgun-web/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js
- /Users/ian/Development/Work/shotgun-web/node_modules/@angular-devkit/architect/node/index.js
- /Users/ian/Development/Work/shotgun-web/node_modules/@nrwl/tao/src/commands/ngcli-adapter.js
- /Users/ian/Development/Work/shotgun-web/node_modules/@nrwl/tao/src/commands/run.js
- /Users/ian/Development/Work/shotgun-web/node_modules/@nrwl/tao/index.js
- /Users/ian/Development/Work/shotgun-web/node_modules/@nrwl/cli/lib/run-cli.js## Expected Behavior

Its a brand new project so it should build, I have tried removing node_modules and starting again - the same happens.

Steps to Reproduce

Run the following command

npx create-nx-workspace@latest --packageManager=yarn

Now choose "Nextjs" then after everything finishes - try and build using yarn build.

p.s. I am also using the following .yarnrc.yml

yarnPath: ".yarn/releases/yarn-berry.cjs"
nodeLinker: node-modules

I also tried the following this should not be necessary as its a new project but I tried it as I found it in the issue list, but nothing changes

npx @nrwl/tao@latest migrate latest

Environment

  "devDependencies": {
    "@babel/core": "7.9.6",
    "@babel/preset-env": "7.9.6",
    "@babel/preset-react": "7.9.4",
    "@babel/preset-typescript": "7.9.0",
    "@nrwl/cli": "11.3.0",
    "@nrwl/cypress": "11.3.0",
    "@nrwl/eslint-plugin-nx": "11.3.0",
    "@nrwl/jest": "11.3.0",
    "@nrwl/linter": "11.3.0",
    "@nrwl/next": "11.3.0",
    "@nrwl/react": "11.3.0",
    "@nrwl/tao": "11.3.0",
    "@nrwl/web": "11.3.0",
    "@nrwl/workspace": "11.3.0",
@iangregsondev
Copy link
Author

Doing the following seems to fix it

yarn add  @angular-devkit/schematics -

But I would appreciate some guidance as it shouldn't fail on the first run.

Is NX still dependent on @angular-devkit/schematics for NON angular apps ?

@vsavkin
Copy link
Member

vsavkin commented Feb 22, 2021

Fixed in 11.3.1. It doesn't depend on @angular-devkit/schematics for next apps. It's a bug where the utility function we require is in file that contains another utility function that does import the schematics package So it's an accident. I hot fixed it in 11.3.1, but we will clean it up this week so such things won't happen again. Sorry about that.

@vsavkin vsavkin closed this as completed Feb 22, 2021
@iangregsondev
Copy link
Author

Ok thanks @vsavkin , so once I update, what should I do - just uninstall the schematics i assume - and all should work.

@dgonzalezr
Copy link

Unfortunately, this seems to still be happening on version 13.8.3.

image

Brand new empty workspace, added a Stenciljs library and tried to serve the library.

🤔

@csenk
Copy link

csenk commented Mar 2, 2022

Happened as well, after updating from 12.0.8 to 12.10.1.

@michaelcamper
Copy link

Some problem occurs as soon as using:

import { getProjectConfig } from '@nrwl/workspace';

@danfoust
Copy link

danfoust commented Jan 6, 2023

Encountered this issue building a plugin with 15.4.4. Found it was caused by using the top level barrel import for libraryGenerator:

import { libraryGenerator } from '@nrwl/workspace';

Fix, import from generators barrel inside @nrwl/workspace

import { libraryGenerator } from '@nrwl/workspace/generators';

I shortened the import path from the index.ts snippet while following this recipe.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants