create-config icon indicating copy to clipboard operation
create-config copied to clipboard

pnpm: could not install dependency packages at project root

Open WataruNishimura opened this issue 10 months ago • 3 comments

Environment

  • ESLint 8.57.0
  • Node 20.11.1
  • eslint/config 1.0.1

What is happening

After selecting options, when I choosed package manager pnpm at project root and tried to instal packages, pnpm throw errors below.

 ERR_PNPM_ADDING_TO_ROOT  Running this command will add the dependency to the workspace root, which might not be what you want - if you really meant it, make it explicit by running this command again with the -w flag (or --workspace-root). If you don't want to see this warning anymore, you may set the ignore-workspace-root-check setting to true.

Solution

pnpm workspace is enabled by pnpm-workspace.yaml existence.
reference: https://pnpm.io/ja/workspaces

I think these two steps below can solve this issue.

  • implements findPnpmWorkspaceYaml like findPackageJson in lib/npm-utils.js
    • if finds yaml, return true. if not, return null.
  • impletements like workspaceFlag and pass -w to spawn in installSyncSaveDev in lib/npm-utils.js

reference: https://github.com/eslint/create-config/blob/main/lib/utils/npm-utils.js

Could I create this solution's draft PR?

WataruNishimura avatar Apr 15 '24 05:04 WataruNishimura

sure, PRs are welcome! 👍

aladdin-add avatar Apr 15 '24 05:04 aladdin-add

@aladdin-add thx!

WataruNishimura avatar Apr 15 '24 06:04 WataruNishimura

@aladdin-add I submitted PR of this issue, if you could permission to review, could you do that?

WataruNishimura avatar Apr 17 '24 17:04 WataruNishimura

Oops! It looks like we lost track of this issue. What do we want to do here? This issue will auto-close in 7 days without an update.

github-actions[bot] avatar Jun 16 '24 22:06 github-actions[bot]