nrwl / nx

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

Cannot find module 'nx/src/generators/utils/json' in v13.10.4 #10389

Closed wizardnet972 closed 2 years ago

wizardnet972 commented 2 years ago

Current Behavior

throw Cannot find module 'nx/src/generators/utils/json' error when creating new Angular app.

Expected Behavior

generate angular application or library

Steps to Reproduce

npx create-nx-workspace
Need to install the following packages:
  create-nx-workspace
Ok to proceed? (y) y
✔ Workspace name (e.g., org name)     · org
✔ What to create in the new workspace · apps
/Users/wizardnet972/.npm/_npx/d2207cf76adb22dc/node_modules/create-nx-workspace/bin
✔ Use Nx Cloud? (It's free and doesn't require registration.) · No

 >  NX   Nx is creating your v13.10.4 workspace.

   To make sure the command works reliably in all environments, and that the preset is applied correctly,
   Nx will run "npm install" several times. Please wait.

✔ Installing dependencies with npm
✔ Nx has successfully created the workspace.

 ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Nx CLI is not installed globally.

   This means that you might have to use "yarn nx" or "npx nx" to execute commands in the workspace.
   Run "yarn global add nx" or "npm install -g nx" to be able to execute command directly.

yarn add @nrwl/angular

yarn nx g @nrwl/angular:lib my-lib --dry-run

$ /Users/wizardnet972/repo/org/node_modules/.bin/nx g @nrwl/angular:lib my-lib --dry-run
Cannot find module 'nx/src/generators/utils/json'
Require stack:
- /Users/wizardnet972/repo/org/node_modules/@nrwl/devkit/src/generators/format-files.js
- /Users/wizardnet972/repo/org/node_modules/@nrwl/devkit/index.js
- /Users/wizardnet972/repo/org/node_modules/@nrwl/angular/src/generators/library/library.js
- /Users/wizardnet972/repo/org/node_modules/nx/src/config/workspaces.js
- /Users/wizardnet972/repo/org/node_modules/nx/src/command-line/generate.js
- /Users/wizardnet972/repo/org/node_modules/nx/src/command-line/nx-commands.js
- /Users/wizardnet972/repo/org/node_modules/nx/bin/init-local.js
- /Users/wizardnet972/repo/org/node_modules/nx/bin/nx.js
error Command failed with exit code 1.

This issue may not be prioritized if details are not provided to help us reproduce the issue.

Failure Logs

Environment

yarn run v1.22.11
$ /Users/wizardnet972/repo/org/node_modules/.bin/nx report

 >  NX   Report complete - copy this into the issue template

   Node : 16.13.0
   OS   : darwin arm64
   yarn : 1.22.11

   nx : 13.10.4
   @nrwl/angular : 14.1.7
   @nrwl/cypress : 14.1.7
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.1.7
   @nrwl/eslint-plugin-nx : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 14.1.7
   @nrwl/js : Not Found
   @nrwl/linter : 14.1.7
   @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/schematics : Not Found
   @nrwl/storybook : 14.1.7
   @nrwl/web : Not Found
   @nrwl/workspace : 13.10.4
   typescript : 4.6.4
   rxjs : 6.6.7
   ---------------------------------------
   Community plugins:

✨  Done in 0.75s.
wizardnet972 commented 2 years ago

After I checked the version in npmjs.com I found that for some reason npx use his cache. I clear npx cache npx clear-npx-cache and it's work.

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.