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

pnpm: could not install dependency packages at project root #96

Open
WataruNishimura opened this issue Apr 15, 2024 · 3 comments
Open

Comments

@WataruNishimura
Copy link

WataruNishimura commented Apr 15, 2024

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?

@aladdin-add
Copy link
Member

sure, PRs are welcome! 👍

@WataruNishimura
Copy link
Author

@aladdin-add thx!

@WataruNishimura
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready to Implement
Development

No branches or pull requests

2 participants