Yarn: Wrong global path in windows ($basedir)

Created on 21 Oct 2016  路  17Comments  路  Source: yarnpkg/yarn

Do you want to request a _feature_ or report a _bug_?
bug
What is the current behavior?
i'm installing angular-cli with yarn global.
when running ng --version the result is

D:\Users\xxx>"$basedir/D:/Users/xxx/AppData/Local/Yarn/config/global/node_modules/.bin/ng.cmd"   "$@"
The filename, directory name, or volume label syntax is incorrect.

If the current behavior is a bug, please provide the steps to reproduce.
step:

  • yarn global add angular-cli
  • ng --version

What is the expected behavior?
show the version of angular-cli
Please mention your node.js, yarn and operating system version.

node 6.5.0
yarn 0.16.1
windows 8.1

Note: i'm using nvm to install nodejs

cat-bug os-windows triaged

Most helpful comment

I was having the same issue on Windows 10.
I found a manual way to fix it.

Go to C:\Program Files\nodejs and you'll find a three files for your specific package.
For example, I was installing ember and I had:

  • ember (Unix)
  • ember.cmd (Windows ?)
  • ember.cmd.cmd (Windows)

The fix is to delete ember.cmd and rename ember.cmd.cmd to ember.cmd.

All 17 comments

+1
When I'm installing a cli-tool leancloud-cli globally,and then type lean -h in CMD ,it will flashback.

My system is win10 ,and node version is 4.6.0,
I use nvm install node and npm.Yarn is installed by npm,
I also used .msi file to install downloaded from the Yarn official site ,but still failed.

this is my screenshot (shared by onedrive)

+1
When I'm trying to use gulp this happens:

$basedir/../../Users/Khoa/AppData/Local/Yarn/config/global/node_modules/.bin/gulp.cmd"   "$@"
The system cannot find the path specified.

exit$?

+1 this is also happening to me - my entire console crashes, and what @khoanguyen96 posted is the same error im getting. Just a different module - all global modules.

I've tried installing yarn global add create-react-app on Windows 7 and get the following when I try to run it:
yarn

Clearly something not quite right with global installs on Windows!

I was having the same issue on Windows 10.
I found a manual way to fix it.

Go to C:\Program Files\nodejs and you'll find a three files for your specific package.
For example, I was installing ember and I had:

  • ember (Unix)
  • ember.cmd (Windows ?)
  • ember.cmd.cmd (Windows)

The fix is to delete ember.cmd and rename ember.cmd.cmd to ember.cmd.

@btecu Thanks btecu, this worked for me, too.

@btecu it's not working for me.
what i had:

  • ng
  • ng.cmd
  • ng.cmd.cmd

i try delete ng.cmd and rename ng.cmd.cmd to ng.cmd
what i get after run ng --version: The filename, directory name, or volume label syntax is incorrect.

Same is happening when I tried to install typescript globally

Can confirm this is happening with global installs for me also on windows 10. I've installed with the windows installer.

node: 6.9.1
npm: 4.0.3
yarn: 0.17.10

The suggestion from @btecu worked in my case.
https://github.com/yarnpkg/yarn/issues/1324#issuecomment-256078658

Why this bug is still not fixed in yarn v0.18.0 ?(window 7)

when I yarn global add mocha, then show "$basedir/../../Users/Administrator/AppData/Local/Yarn/config/global/node_modules/.bin/mocha.cmd"

I just ran into this as well.

Windows 10
Node: 7.5.0
NPM: 4.0.2
Yarn: 0.19.1

Definitely unexpected, and a bit hard to track down.

C:\Users\Toby>"$basedir/../../Users/Toby/AppData/Local/Yarn/config/global/node_modules/.bin/knex.cmd"   "$@" 

C:\Users\Toby>exit $? 

Running into the same issue
node v6.9.4
npm 3.10.10
yarn 0.19.1

A simple temporary work around is to remove the broken global packages using yarn global remove and replace them via npm.

Have the same issue. Any progress???

Tried uninstalling yarn and running ng new test-proj after installing @angular/cli with npm and got

"$basedir/../../Users/UserName/AppData/Local/Yarn/.global/node_modules/.bin/ng.cmd"   "$@"
The system cannot find the path specified.

Looks like yarn left some artifacts behind?

the same issue ! I use :
node v6.9.1
npm 3.10.8
nvm
yarn 0.20.3

use the yarn add global package, the location of global package is not same as nvm installed global package.
And I have a question, the location of yarn installed global package is not %LOCALAPPDATA%/Yarn/config/global (window https://github.com/yarnpkg/yarn/issues/2049)

I have the same issue, then I use process monitor to check.

I found that cmd.exe CreateFile C:ProgramDatascoopappsyarncurrentYarnbin
I remember that, weeks ago I installed scoop in C: , but now I install scoop in another dir 'd:ascoop'.
I set env vars SCOOP=d:ascoop , softwares are installed in the new dir, but whey yarn use the old location?

I make a soft link , everthing ok.

mklink /d C:\ProgramData\scoop D:\A\scoop\

Just share, maybe this solution is only for me.

What @iloveyo123u1 worked for me. I think there's some sort of error in the linking process. The global dir config doesn't work in any manner except one-time command line arguments. The global bin prefix option just seems to mess up linking. Can this please get checked on?

Was this page helpful?
0 / 5 - 0 ratings