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

File dependencies that traverse a symlink fail to install #7161

Open
hniirane opened this issue Apr 1, 2019 · 3 comments
Open

File dependencies that traverse a symlink fail to install #7161

hniirane opened this issue Apr 1, 2019 · 3 comments

Comments

@hniirane
Copy link

hniirane commented Apr 1, 2019

Do you want to request a feature or report a bug?
A bug.

What is the current behavior?
The install fails when a local dependency is added via a path where the path contains a symlink. The install fails with an cache error:

error An unexpected error occurred: "ENOENT: no such file or directory, scandir '/home/rohea/.cache/yarn/v4/npm-local-dependency-1.0.0-b7aa11f4-7170-4500-b18a-0d8c0dd25a47-1554094447449/node_modules/local-dependency'".

And the hash (i.e. b7aa11f4-7170-4500-b18a-0d8c0dd25a47-1554094447449) always changes on different runs of yarn install.

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

  1. Clone https://github.com/hniirane/yarn-path-install-bug
  2. Run yarn install
  3. Bug reproduces and gives the error:
yarn install v1.15.2
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
error An unexpected error occurred: "ENOENT: no such file or directory, scandir '/home/rohea/.cache/yarn/v4/npm-local-dependency-1.0.0-b7aa11f4-7170-4500-b18a-0d8c0dd25a47-1554094447449/node_modules/local-dependency'".
info If you think this is a bug, please open a bug report with the information provided in "/home/rohea/yarn-path-install-bug/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

What is the expected behavior?
Yarn would install correctly. The reproducing repository contains a different branch https://github.com/hniirane/yarn-path-install-bug/tree/working-local-dependency that works as expected since the dependency is not loaded via a symlink.

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

$ yarn --version
1.15.2
$ node --version
v8.15.1
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.4 LTS
Release:	16.04
Codename:	xenial
@emodric
Copy link

emodric commented Jun 14, 2019

I've ran into the same issue, using Yarn 1.16.0.

@hniirane Did you find a workaround other than using npm install?

@hniirane
Copy link
Author

I did not find any workaround that would utilize the symlinks @emodric. Due to the way the path dependencies work in npm/yarn makes them a bit less useful anyway, since the files are copied to the node_modules instead of being used directly from the path.

We ended up setting things up so that the actual dependency folder is fully copied to the dependency path and then yarn link is used to setup so that the code is actually used from where we want. Works for your use case, but is not pretty.

I would still like to see this resolved as now it's a kludgy hack.

@emodric
Copy link

emodric commented Jun 19, 2019

In my tests, npm actually created the symlink if the path to the dependency was the symlink itself. So, that's one workaround.

But yeah, I reverted back to using yarn link too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants