Global installed package with wrong startup script
I installed my Node.JS in D:\Node\v6.9.1 , then I use Yarn install the global package successfully:
yarn install webpack
However, when I run it:
λ webpack
The filename, directory name, or volume label syntax is incorrect.
I discovered that Yarn install global package at C:\Users\Wenris\AppData\Local\Yarn\config\global instead of C:\Users\Wenris\AppData\Roaming\npm , where my NPM choose.
That's all right, but Yarn installed a wrong startup script webpack.cmd in my Node.JS root dir:
λ cat webpack.cmd
@"%~dp0\C:\Users\Wenris\AppData\Local\Yarn\config\global\node_modules\.bin\webpack.cmd" %*
So?
If I changed the script to:
echo @"%~dp0\C:\Users\Wenris\AppData\Local\Yarn\config\global\node_modules\.bin\webpack.cmd" %*
Then I got:
λ webpack
@"D:\Node\v6.9.1\\C:\Users\Wenris\AppData\Local\Yarn\config\global\node_modules\.bin\webpack.cmd"
https://github.com/yarnpkg/yarn/issues/2630
This is a bug with cmd-shim when Node.js is on a different hard-drive than Yarn's cache: https://github.com/ForbesLindesay/cmd-shim/issues/21. It should be fixed in cmd-shim. Once a new version is available, we can update the dependency in Yarn.