yarnpkg/yarn

Missing global dependency generates unhelpful message

Open

#5134 opened on Dec 28, 2017

View on GitHub
 (3 comments) (0 reactions) (1 assignee)JavaScript (41,514 stars) (2,731 forks)batch import
cat-featuregood first issuehelp wantedtriaged

Description

Do you want to request a feature or report a bug? Bug - Unhelpful error message

What is the current behavior?

Commands like yarn global list are failing on my system with the message error "C:\\code\\antlr4ts\\tool" doesn't exist. This is of my own doing (I recognize the missing directory, and had intentionally deleted it) but it wasn't clear how to recover. More context on what yarn was doing would have helped.

I tracked it down to the file C:\Users\Burt_\AppData\Local\Yarn\config\global\package.json, which contained:

{
  "dependencies": {
    "antlr4ts-cli": "file:\\code\\antlr4ts\\tool",
    "gulp-cli": "^2.0.0",
    "lerna": "^2.5.1",
    "rimraf": "^2.6.2",
    "typescript": "^2.6.2"
  }
}

Workaround

Once I knew what package was involved, yarn global remove antlr4ts-cli fixed it up.

Stack Trace

verbose 0.669 Error: "C:\\code\\antlr4ts\\tool" doesn't exist.
    at MessageError (C:\Program Files (x86)\Yarn\lib\cli.js:139:5)
    at C:\Program Files (x86)\Yarn\lib\cli.js:48701:15
    at next (native)
    at step (C:\Program Files (x86)\Yarn\lib\cli.js:92:30)
    at C:\Program Files (x86)\Yarn\lib\cli.js:103:13

If the current behavior is a bug, please provide the steps to reproduce. Sorry, I wish I could answer better how I got this entry. As a guess, I must have used something like:

yarn global add file:c:\\code\antlr4ts\tool

What is the expected behavior? Best would be to recover automatically from this using behavior like yarn global remove

Please mention your node.js, yarn and operating system version. os: Microsoft Windows [Version 10.0.16299.125] node: v6.12.2 yarn: 1.3.2 (installed w/ .msi)

Contributor guide