Description
Self-service
- I'd be willing to implement a fix
Describe the bug
If you explicitly have script-shell=pwsh
in .npmrc
, the yarn preinstall script fails if yarn is a dependency of another project. The generated syntax is pwsh -c :; (node ./preinstall.js > /dev/null 2>&1 || true)
, which isn't valid PowerShell syntax. This blocks the module from ever finishing installation.
To reproduce
npm config set script-shell pwsh
npm i -g oclif
oclif generate <my-cli>
cd my-cli
npm i
Yarn appears to be a dependency of https://github.com/oclif/plugin-plugins, which is then depended on by https://github.com/oclif/oclif.
The issue can be resolved by removing the offending line in .npmrc, but that doesn't really solve the underlying problem, which is that yarn is generating invalid syntax for the environment it's running in.
Environment
System:
OS: Windows 10 10.0.19042
CPU: (8) x64 Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz
Binaries:
Node: 14.16.0 - ~\AppData\Local\Temp\xfs-c51972fb\node.CMD
Yarn: 1.22.15 - ~\AppData\Local\Temp\xfs-c51972fb\yarn.CMD
npm: 8.3.2 - C:\Program Files\nodejs\npm.CMD
Additional context
The relevant yarn dependency entry from oclif/plugin-plugins
"^1.22.17", which is properly downloaded. The script appears to run against the higher version, which generates the issue.