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

Latest version of prettier cause nx to crash (3.0.1) #18496

Closed
1 of 4 tasks
maxime4000 opened this issue Aug 4, 2023 · 3 comments
Closed
1 of 4 tasks

Latest version of prettier cause nx to crash (3.0.1) #18496

maxime4000 opened this issue Aug 4, 2023 · 3 comments

Comments

@maxime4000
Copy link

Current Behavior

Cannot run nx format:write anymore.
https://prettier.io/blog/2023/07/05/3.0.0#api

Expected Behavior

nx format still works.

GitHub Repo

No response

Steps to Reproduce

  1. Make a mono repo
  2. Setup prettier
  3. run nx format
  4. crash

Nx Report

Node   : 18.16.0
   OS     : darwin-arm64
   npm    : 9.5.1
   
   nx                 : 16.6.0
   @nx/js             : 16.6.0
   @nx/jest           : 16.6.0
   @nx/linter         : 16.6.0
   @nx/workspace      : 16.6.0
   @nx/cypress        : 16.6.0
   @nx/devkit         : 16.6.0
   @nx/eslint-plugin  : 16.6.0
   @nx/nest           : 16.6.0
   @nx/next           : 16.6.0
   @nx/node           : 16.6.0
   @nx/plugin         : 16.6.0
   @nx/react          : 16.6.0
   @nx/storybook      : 16.6.0
   @nrwl/tao          : 16.6.0
   @nx/vite           : 16.6.0
   @nx/web            : 16.6.0
   @nx/webpack        : 16.6.0
   typescript         : 5.1.6
   ---------------------------------------
   Community plugins:
   @nx-tools/nx-prisma : 5.0.2
   @nxlv/python        : 16.1.2
   --------------------------------

Failure Logs

nx format:write

Overwrite un-formatted files

Run command using --base=[SHA1] (affected by the committed,
uncommitted and untracked changes):
  --base  Base of the current branch (usually main) [string]

or using --base=[SHA1] --head=[SHA2] (affected by the
committed changes):
  --base  Base of the current branch (usually main) [string]
  --head  Latest commit of the current branch (usually HEAD)
                                                    [string]

or using:
  --files        Change the way Nx is calculating the
                 affected command by providing directly
                 changed files, list of files delimited by
                 commas or spaces                   [string]
  --uncommitted  Uncommitted changes               [boolean]
  --untracked    Untracked changes                 [boolean]

Options:
  --help           Show help                       [boolean]
  --version        Show version number             [boolean]
  --exclude        Exclude certain projects from being
                   processed                        [string]
  --libs-and-apps  Format only libraries and applications
                   files.                          [boolean]
  --projects       Projects to format (comma/space
                   delimited)                       [string]
  --all            Format all projects             [boolean]

Find more information and examples at
https://nx.dev/nx/format-write

Error: Cannot find module '/Users/maxime/Repo/monorepo/node_modules/prettier/bin-prettier'
    at createEsmNotFoundErr (node:internal/modules/cjs/loader:1096:15)
    at finalizeEsmResolution (node:internal/modules/cjs/loader:1089:15)
    at resolveExports (node:internal/modules/cjs/loader:565:14)
    at Module._findPath (node:internal/modules/cjs/loader:634:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1061:27)
    at Function.resolve (/Users/maxime/Repo/monorepo/node_modules/v8-compile-cache/v8-compile-cache.js:164:23)
    at Object.<anonymous> (/Users/maxime/Repo/monorepo/node_modules/nx/src/command-line/format/format.js:18:31)
    at Module._compile (/Users/maxime/Repo/monorepo/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32) {
  code: 'MODULE_NOT_FOUND',
  path: '/Users/maxime/Repo/monorepo/node_modules/prettier/package.json'
}

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@curthipster
Copy link
Contributor

Duplicate of #17990?

@mandarini
Copy link
Member

Yes @curthipster ! Indeed it's a duplicate! I will close this in favor of the feature request, since it's more of a feature request to upgrade to prettier@3!

@github-actions
Copy link

github-actions bot commented Sep 8, 2023

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 Sep 8, 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

3 participants