Yarn: [BUG] "yarn global add tslint" - error execute installed global package

Created on 18 Oct 2016  路  7Comments  路  Source: yarnpkg/yarn

Do you want to request a _feature_ or report a _bug_?
Bug.

What is the current behavior?
Randomly ERROR and cannot execute global installed package (Ex: tslint)

C:\Users\myname>yarn global ls
yarn global v0.15.1
warning No license field

Done in 0.05s.

C:\Users\myname>yarn global add tslint
yarn global v0.15.1
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning Unmet peer dependency "typescript@>=1.7.3".
[4/4] Building fresh packages...
success Installed [email protected] with binaries:
      - tslint
Done in 2.67s.

C:\Users\myname>yarn global add typescript
yarn global v0.15.1
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
error ENOENT: no such file or directory, open 'C:\Users\myname\AppData\Local\Yarn\.global\node_modules\balanced-match\.np                                                                                                                   mignore'
    at Error (native)
info Visit http://yarnpkg.com/en/docs/cli/global for documentation about this command.

C:\Users\myname>yarn global add typescript
yarn global v0.15.1
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed [email protected] with binaries:
      - tsc
      - tsserver
Done in 2.89s.

C:\Users\myname>yarn global ls
yarn global v0.15.1
warning No license field
error ENOENT: no such file or directory, open 'C:\Users\myname\AppData\Local\Yarn\.global\node_modules\balanced-match\.npmignore'
    at Error (native)
info Visit http://yarnpkg.com/en/docs/cli/global for documentation about this command.

C:\Users\myname>yarn global ls
yarn global v0.15.1
warning No license field
info [email protected] has binaries:
   - tslint
info [email protected] has binaries:
   - tsc
   - tsserver
Done in 1.61s.

C:\Users\myname>tslint
< NO OUTPUT, because it forces exiting my cmd >

If the current behavior is a bug, please provide the steps to reproduce.
Try to install a global package, and execute it.

What is the expected behavior?
npm works perfectly. yarn's installed package causes exit my cmd / powershell.

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

  • Windows 10 Pro x64
  • node v6.8.1
  • yarn v0.15.1
cat-bug os-windows triaged

Most helpful comment

This is a duplicate of #1585 by the looks of it, but is still an issue on macOS using v0.19.1.

All 7 comments

I can't run the globally added packages at all.

It looks like yarn adds C:\Users\{user}\AppData\Local\Yarn\.bin to the path, but .bin does not exist. Instead, I added C:\Users\{user}\AppData\Local\Yarn\config\global\node_modules\.bin to my path, and it worked.

This is a duplicate of #1585 by the looks of it, but is still an issue on macOS using v0.19.1.

I'm seeing the same issue with

  • OS X El Capitan 10.11.6
  • node v7.4.0
  • yarn 0.19.1

Currently using the workaround of creating symlink from /Users/{user}/.config/yarn/global/node_modules/.../bin to /usr/local/Cellar/node/7.4.0/bin/

I also experience this issue, that is I couldn't run globally added packages.

I followed @innerspirit suggestion and added C:\Users\chrisAppData\Local\Yarn\config\globalnode_modules.bin to my Windows environment path and now its fixed.

I had to write this path in manually as well.
Packages still aren't listed under yarn global ls though

I cannot reproduce this on linux. Adding typescript and tslint globally works fine:

$ yarn global add typescript
yarn global v0.27.5
warning package.json: No license field
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
      - tsc
      - tsserver
warning No license field
Done in 1.70s.

$ yarn global add tslint
yarn global v0.27.5
warning package.json: No license field
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
      - tslint
warning No license field
Done in 1.46s.

The scripts are put in place as expected:

$ ls $(yarn global bin)
semver  tsc  tslint  tsserver

And work as expected:

$ tslint 
Missing files

However, when adding eslint globally on the same linux machine:

$ yarn global add eslint
yarn global v0.27.5
warning package.json: No license field
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
      - eslint
warning No license field
Done in 1.13s.

Its scripts are not put in place for some reason:

$ ls $(yarn global bin)
# does not contain eslint

Probably it is a separate issue, which is better described in #2360.

Was this page helpful?
0 / 5 - 0 ratings