Yarn: `yarn global add yo` but yo not work

Created on 4 Feb 2017  ·  2Comments  ·  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
yo --version throws exception 文件名、目录名或卷标语法不正确。
If the current behavior is a bug, please provide the steps to reproduce.

  1. install nodejs v7.5.0 change path to ${nodejs_home}
  2. change prefix : ${nodejs_home} and change cache : ${nodejs_home} node_cache
  3. install yarn v0.19.1 change path to ${yarn_home}
  4. change cache dir : ${yarn_home}cache
  5. yarn global add yo ; yo --version
    output error msg 文件名、目录名或卷标语法不正确。

What is the expected behavior?

yo --version
# output 1.8.5

Note
i modify ${nodejs_home} \yo.cmd

#before 

@"%~dp0\C:\Users\${userName}\AppData\Local\Yarn\config\global\node_modules\.bin\yo.cmd"   %*


#after
# remove %~dp0\ like this

@"C:\Users\${userName}\AppData\Local\Yarn\config\global\node_modules\.bin\yo.cmd"   %*

is successful !

Please mention your node.js, yarn and operating system version.

  • OS Version Windows 10 1607(os version 14393.693)
  • Nodejs version v7.5.0
  • yarn version v0.19.1
  • yo version 1.8.5
  • powershell v1

Most helpful comment

@anjia0532 你需要在path把C:\Users\win7\AppData\Local\Yarn\config\global\node_modules\.bin 加到
D:\Program Files\nodejs\; nodejs的path前面, 这样才能正确识别到正确的 yo.cmd.

node_modules\.bin下的yo.cmd是正确的

All 2 comments

@anjia0532 你需要在path把C:\Users\win7\AppData\Local\Yarn\config\global\node_modules\.bin 加到
D:\Program Files\nodejs\; nodejs的path前面, 这样才能正确识别到正确的 yo.cmd.

node_modules\.bin下的yo.cmd是正确的

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fishrock123 picture Fishrock123  ·  103Comments

carlosduclos picture carlosduclos  ·  86Comments

fahrradflucht picture fahrradflucht  ·  120Comments

jmorrell picture jmorrell  ·  93Comments

id77 picture id77  ·  109Comments