Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing global dependency generates unhelpful message #5134

Open
BurtHarris opened this issue Dec 28, 2017 · 3 comments
Open

Missing global dependency generates unhelpful message #5134

BurtHarris opened this issue Dec 28, 2017 · 3 comments

Comments

@BurtHarris
Copy link
Contributor

BurtHarris commented Dec 28, 2017

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)

@rally25rs
Copy link
Contributor

rally25rs commented Dec 29, 2017

It seems reasonable that on error, we could have a message that says something like The ___ package appears to be missing. It may have been deleted. You can remove this from Yarn's like of global packages with the command "yarn global remove ___"

Or someone propose better wording...

@iansu
Copy link
Contributor

iansu commented Dec 31, 2017

This seems to be unique to file:// URLs where the file pointed to is missing. This can happen with local and global packages so that makes the error message a bit trickier. Maybe just something like <dir> doesn't exist. It may have been deleted. You can remove it with the command "yarn remove <package name>"?

@BurtHarris
Copy link
Contributor Author

Either message would have made things easier...

arcanis pushed a commit that referenced this issue Jan 15, 2018
…5134) (#5145)

* feat(cli): improve error message when file resolver can't find file (#5134)

* Update en.js

* Update en.js
agoldis added a commit to agoldis/yarn that referenced this issue Feb 2, 2018
…readdir_files

* upstream/master: (34 commits)
  feat(upgrade, add): Separately log added/upgraded dependencies (yarnpkg#5227)
  feat(publish): Publish command uses publishConfig.access in package.json (yarnpkg#5290)
  fix(CLI): Use process exit instead of exitCode for node < 4 (yarnpkg#5291)
  feat(cli): error on missing workspace directory (yarnpkg#5206) (yarnpkg#5222)
  feat: better error when package is not found (yarnpkg#5213)
  Allow scoped package as alias source (yarnpkg#5229)
  fix(cli): Use correct directory for upgrade-interactive (yarnpkg#5272)
  nohoist baseline implementation (yarnpkg#4979)
  1.4.1
  1.4.0
  Show current version, when new version is not supplied on "yarn publish" (yarnpkg#4947)
  fix(install): use node-gyp from homebrew npm (yarnpkg#4994)
  Fix transient symlinks overriding direct ones v2 (yarnpkg#5016)
  fix(auth): Fixes authentication conditions and logic with registries (yarnpkg#5216)
  chore(package): move devDeps to appropriate place (yarnpkg#5166)
  fix(resolution) Eliminate "missing peerDep" warning when dep exists at root level. (yarnpkg#5088)
  fix(cli): improve guessing of package names that contain a dot (yarnpkg#5102) (yarnpkg#5135)
  feat(cli): include notice with license when generating disclaimer (yarnpkg#5072) (yarnpkg#5111)
  feat(cli): group by license in licenses list (yarnpkg#5074) (yarnpkg#5110)
  feat(cli): improve error message when file resolver can't find file (yarnpkg#5134) (yarnpkg#5145)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants