`preferLocal` doesn't work for if dependent projects are using `pnpm`, `yarn pnp` or `deno install`
This was initially reported as a bug in my library:
- https://github.com/felipecrs/semantic-release-vsce/issues/844
But after further investigation, I think this should be addressed in `execa`.
I built a reproduction:
1. https://github.com/felipecrs/repro-execa-pnpm
1. https://github.com/felipecrs/repro-execa-pnpm-child
```console
$ git clone https://github.com/felipecrs/repro-execa-pnpm-child
$ cd repro-execa-pnpm-child
$ npm install
# works
$ node index.js
0.10.5
$ rm -rf node_modules package-lock.json
$ pnpm install
$ node index.js
0.10.5
file:///home/felipecrs/repos/repro-execa-pnpm/project-a/node_modules/.pnpm/execa@9.6.0/node_modules/execa/lib/return/final-error.js:6
return new ErrorClass(message, options);
^
ExecaError: Command failed with EACCES: ovsx --version
spawn ovsx EACCES
at getFinalError (file:///home/felipecrs/repos/repro-execa-pnpm/project-a/node_modules/.pnpm/execa@9.6.0/node_modules/execa/lib/return/final-error.js:6:9)
at makeError (file:///home/felipecrs/repos/repro-execa-pnpm/project-a/node_modules/.pnpm/execa@9.6.0/node_modules/execa/lib/return/result.js:108:16)
at getAsyncResult (file:///home/felipecrs/repos/repro-execa-pnpm/project-a/node_modules/.pnpm/execa@9.6.0/node_modules/execa/lib/methods/main-async.js:168:4)
at handlePromise (file:///home/felipecrs/repos/repro-execa-pnpm/project-a/node_modules/.pnpm/execa@9.6.0/node_modules/execa/lib/methods/main-async.js:151:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async main (file:///home/felipecrs/repos/repro-execa-pnpm/project-a/index.js:4:5)
at async file:///home/felipecrs/repos/repro-execa-pnpm/project-b/index.js:3:1 {
shortMessage: 'Command failed with EACCES: ovsx --version\nspawn ovsx EACCES',
originalMessage: 'spawn ovsx EACCES',
command: 'ovsx --version',
escapedCommand: 'ovsx --version',
cwd: '/home/felipecrs/repos/repro-execa-pnpm/project-b',
durationMs: 70.879539,
failed: true,
timedOut: false,
isCanceled: false,
isGracefullyCanceled: false,
isTerminated: false,
isMaxBuffer: false,
isForcefullyTerminated: false,
code: 'EACCES',
stdio: [ undefined, undefined, undefined ],
ipcOutput: [],
pipedFrom: [],
[cause]: Error: spawn ovsx EACCES
at ChildProcess._handle.onexit (node:internal/child_process:285:19)
at onErrorNT (node:internal/child_process:483:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -13,
code: 'EACCES',
syscall: 'spawn ovsx',
path: 'ovsx',
spawnargs: [ '--version' ]
}
}
```
It would be super nice if `execa` itself could provide a solution for it.
14 条评论