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

Workspaces with "nohoist": ["**"] fails with ENOENT error #6988

Closed
ryanashcraft opened this issue Feb 1, 2019 · 11 comments
Closed

Workspaces with "nohoist": ["**"] fails with ENOENT error #6988

ryanashcraft opened this issue Feb 1, 2019 · 11 comments
Assignees
Labels
fixed-in-modern This issue has been fixed / implemented in Yarn 2+. triaged

Comments

@ryanashcraft
Copy link

What is the current behavior?

On a large monorepo project with 5+ packages, adding "nohoist": ["**"] to the root package.json results in ENOENT errors, for example:

error An unexpected error occurred: "ENOENT: no such file or directory, lstat '/Users/ryanashcraft/Work/javascript/packages/eslint-config-amplitude-base/node_modules/table/node_modules/lodash'".
info If you think this is a bug, please open a bug report with the information provided in "/Users/ryanashcraft/Work/javascript/yarn-error.log".

/Users/ryanashcraft/Work/javascript/packages/eslint-config-amplitude-base/node_modules/table/node_modules is an empty directory.

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

This project is closed-source, so I can't provide a link. Happy to provide more information about the project if helpful.

What is the expected behavior?

The install succeeds, and all packages are not hoisted to the root repo directory.

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

yarn: v1.13.0
node: v10.15.0
macOS: 10.14.2

Related issues.

I decided to make a separate issue for this as it relates specifically to configuring "nohoist": ["**"]:

#6042
#5421
#5601
#4563

@ghost ghost assigned arcanis Feb 1, 2019
@ghost ghost added the triaged label Feb 1, 2019
@timini
Copy link

timini commented Feb 4, 2019

Also experiencing this with same node and yarn verisons, but running in docker

@SuaYoo
Copy link

SuaYoo commented Mar 18, 2019

I'm running into this issue as well. I've created a simple reproduction repo here: https://github.com/SuaYoo/yarn-workspace-nohoist-issue

Notes:

  • Narrowed down from my real-life dependencies to css-loader in package b using half splitting. However, the actual file/directory that was missing changed throughout the process -- from /packages/b/node_modules/json5 to /packages/b/node_modules to finally /packages/b/node_modules/css-loader.
  • Cannot reproduce when major versions of css-loader are the same (e.g. no issues on install when both package a and b have "css-loader": "^1.0.0" specified.)
  • Cannot reproduce when package a does not reference package b in dependencies/devDependencies.
  • Cannot reproduce when package a has "nohoist": ["css-*"] or "nohoist": ["css-loader"].

@matthargett
Copy link

We have the same issue, but with the acorn package. My main problem here is that the error message is unacceptably obtuse:
error An unexpected error occurred: "ENOENT: no such file or directory, lstat '/mnt/c/Users/matt/workspace/hub/packages/hub-queries/node_modules/eslint-plugin-react/node_modules/acorn'".

I was able to work around the problem by deleting my yarn.lock (also unnacceptable), and now I'm going to hand-edit my yarn.lock file. If the CLI could tell me I need to reconcile/remove differing versions of acorn, with line numbers, that would be very helpful.

@dizel3d
Copy link

dizel3d commented May 7, 2019

node 8.6.0, yarn 1.15.2. Got the same error.
error An unexpected error occurred: "ENOENT: no such file or directory, lstat '/Users/dizel3d/projects/my-project/packages/my-package/node_modules/worker-farm/node_modules'".

@crubier
Copy link

crubier commented May 14, 2019

Same here

@sghoweri
Copy link

We're having the exact same issue (already reported here -- any ideas on a potential workaround?

@grebenyuksv-preply
Copy link

any updates on this?

@baflo
Copy link

baflo commented Sep 6, 2019

anything?

@await-ovo
Copy link

same here

@arcanis
Copy link
Member

arcanis commented Sep 9, 2019

The nohoist setting is a workaround, and not a part of Yarn we plan to improve (it won't be part of the v2, since the hoisting mechanism will be very different due to PnP being used by default).

I'm willing to review and merge a PR that would fix the behaviour described in this issue, but I don't have the bandwidth to work on it myself while we're hard at work on the v2. Thanks for your understanding.

@yarnpkg yarnpkg locked as spam and limited conversation to collaborators Sep 9, 2019
@paul-soporan
Copy link
Member

Closing as this won't happen anymore in the v2 where installConfig.hoistingLimits should be used instead of noHoist.

https://yarnpkg.com/getting-started/migration

@paul-soporan paul-soporan added the fixed-in-modern This issue has been fixed / implemented in Yarn 2+. label Jan 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed-in-modern This issue has been fixed / implemented in Yarn 2+. triaged
Projects
None yet
Development

No branches or pull requests