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

[Bug?]: yarn link failing with NodeModulesLinker: "Assertion failed: Writing attempt prevented to ..." #3413

Closed
1 task
itsjamie opened this issue Sep 9, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@itsjamie
Copy link

itsjamie commented Sep 9, 2021

Self-service

  • I'd be willing to implement a fix

Describe the bug

Two projects, that are both setup as yarn workspaces separately. Looking to run yarn link -r ../sibling-project/javascript.

Fails with:

Assertion failed: Writing attempt prevented to <snip>/sibling-project/javascript/node_modules/lodash-es which is outside project root: <snip>/main-project

To reproduce

sibling-project package.json has a workspaces field that indicates javascript is a workspace.
main-project contains many package-based workspaces, and is trying to link a non-migrated dependency in as a dependency.

Environment

System:
OS: macOS 11.5.2
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Binaries:
Node: 12.20.1 - /private/var/folders/rz/8pj9lzz12fqfx51ddh4x5k813x2t56/T/xfs-c9714123/node
Yarn: 3.0.1 - /private/var/folders/rz/8pj9lzz12fqfx51ddh4x5k813x2t56/T/xfs-c9714123/yarn
npm: 6.14.10 - ~/.nvm/versions/node/v12.20.1/bin/npm

Additional context

No response

@itsjamie itsjamie added the bug Something isn't working label Sep 9, 2021
@larixer
Copy link
Member

larixer commented Sep 10, 2021

Fixed in #3183, merged, but not released yet. To try the fix use yarn set version from sources and then yarn to install dependencies using version with the fix.

@larixer larixer closed this as completed Sep 10, 2021
@merceyz
Copy link
Member

merceyz commented Sep 10, 2021

It's in the canary release at the moment so you can alternatively run

yarn set version canary && yarn

@kldavis4
Copy link

This still seems like an issue for me with 3.2.0-rc.7 using the node-modules nodeLinker. Any ideas what might be going on?

@larixer
Copy link
Member

larixer commented Dec 11, 2021

@kldavis4 Please open a new issue with reproduction. If you want to troubleshoot a bit yourself, you can use NM_DEBUG_LEVEL=2 yarn to see the hoisted tree and check with the write path in the error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants