create-config
create-config copied to clipboard
pnpm: could not install dependency packages at project root
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
likefindPackageJson
inlib/npm-utils.js
- if finds yaml, return true. if not, return null.
- impletements like
workspaceFlag
and pass-w
to spawn ininstallSyncSaveDev
inlib/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?
sure, PRs are welcome! 👍
@aladdin-add thx!
@aladdin-add I submitted PR of this issue, if you could permission to review, could you do that?
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.