Skip to content

ENOTDIR when using yarn 3 #15119

@commscheck

Description

@commscheck

Environments:

  • Prettier Version: 3.0.0
  • Running Prettier via: yarn prettier
  • Runtime: Node.js v18.16.1
  • Operating System: macOS
  • Prettier plugins (if any): none

Steps to reproduce:

# Enable yarn 3:
# https://yarnpkg.com/getting-started/install
corepack enable
corepack prepare yarn@stable --activate

# Create a new project:
yarn init -2

# Install prettier:
yarn add --dev --exact prettier

# Ignore generated files:
cat > .prettierignore << EOL
.yarn/*
.pnp.cjs
yarn.lock
EOL

# Run prettier:
yarn prettier .

Expected behavior:

Prettier commands succeed.

Actual behavior:

All prettier commands fail with the following output:

❯ yarn prettier .
node:fs:1615
  handleErrorFromBinding(ctx);
  ^

Error: ENOTDIR: not a directory, stat '/Users/ben/src/prettier-test/.yarn/cache/prettier-npm-3.0.0-7ffbcce680-6a832876a1.zip/node_modules/prettier/internal/cli.mjs'
    at statSync (node:fs:1615:3)
    at tryStatSync (node:internal/modules/esm/resolve:176:13)
    at finalizeResolution (node:internal/modules/esm/resolve:316:17)
    at moduleResolve (node:internal/modules/esm/resolve:945:10)
    at defaultResolve (node:internal/modules/esm/resolve:1153:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ESMLoader.import (node:internal/modules/esm/loader:525:22)
    at importModuleDynamically (node:internal/modules/cjs/loader:1188:29) {
  errno: -20,
  syscall: 'stat',
  code: 'ENOTDIR',
  path: '/Users/ben/src/prettier-test/.yarn/cache/prettier-npm-3.0.0-7ffbcce680-6a832876a1.zip/node_modules/prettier/internal/cli.mjs'
}

Node.js v18.16.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliIssues with Prettier's Command Line Interfacelocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.status:needs investigationIssues that need additional investigation, e.g. to understand whether the reported behavior is a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions