question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug?]: `ENOENT` in Redwood contributing workflow using Yarn

See original GitHub issue

Self-service

  • I’d be willing to implement a fix

Describe the bug

Hey everyone. Opening this because I’m seeing a YN0001 error code, but I’m not entirely convinced this is a bug in Yarn yet.

I work on Redwood; there’s an issue in our contributing workflow that’s slowing down development. I’ll write it up as best I can below, but here’s a link to a video of the bug that I recommend watching if you can: https://s.tape.sh/9hTynWoS.

Both the Redwood framework and Redwood projects use Yarn 3, but they use the "node-modules" nodeLinker because we don’t follow the new rules yet.

Right now, to test new features in the framework on projects, we copy the framework’s packages’ dist to projects node_modules. So we’re modifying node_modules from under Yarn. (Note that we’re only doing this because we couldn’t seem to get yarn link to work, maybe because we don’t follow the new rules yet?)

We made our own contributing tool to do this, and while it mostly works quite well, if you try to yarn install after node_modules has been modified by our contributing tool, Yarn throws a YN0001 error code during the link step:

➤ YN0000: ┌ Link step
➤ YN0001: │ Error: ENOENT: no such file or directory, lstat '/Users/dom/prjcts/redwood_project/redwood_project/node_modules/@redwoodjs/core/node_modules/semver'
➤ YN0000: └ Completed in 0s 636ms

Is this actually a bug in yarn? Or are we breaking the contract by modifying node_modules and expecting yarn installs to still work after?

Lastly, thanks again for when we migrated from yarn 1 to yarn 3—everyone was amazingly helpful!

To reproduce

I’ll try to get this working in Sherlock, but in the meantime the video I linked to above shows the exact steps I took: https://s.tape.sh/9hTynWoS. And the issue should be reproducible locally by following the steps I took:

# Clone the Redwood framework, install deps and build
git clone https://github.com/redwoodjs/redwood.git
cd redwood
yarn
yarn build

# Make a redwood project
cd ~
yarn create redwood-app redwood-project

# Contributing workflow; `RWFW_PATH` is the path to your local copy of the framework
cd redwood-project
RWFW_PATH=~/redwood yarn rwfw project:deps && yarn
RWFW_PATH=~/redwood yarn rwfw project:copy

# Now installing again should throw the error
yarn
...
➤ YN0000: ┌ Link step
➤ YN0001: │ Error: ENOENT: no such file or directory, lstat '/Users/dom/prjcts/redwood_project/redwood_project/node_modules/@redwoodjs/core/node_modules/semver'
➤ YN0000: └ Completed in 0s 636ms

Environment

System:
    OS: macOS 12.1
    CPU: (8) arm64 Apple M1
  Binaries:
    Node: 16.15.0 - /private/var/folders/dt/yks4v5m53k114qxgz6jh4pgw0000gn/T/xfs-e9f6d41d/node
    Yarn: 3.2.0 - /private/var/folders/dt/yks4v5m53k114qxgz6jh4pgw0000gn/T/xfs-e9f6d41d/yarn
    npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm
  npmPackages:
    jest: 27.5.1 => 27.5.1

Additional context

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
merceyzcommented, May 13, 2022

I see you noticed but for any future readers; the fix was backported and released in Yarn v3.2.1.

maybe the best way forward is for us to start migrating off the “node-modules” nodeLinker following these two guides?

Maybe, though you might be able to solve the symlink issue with --preserve-symlinks

0reactions
jtoarcommented, May 14, 2022

Maybe, though you might be able to solve the symlink issue with –preserve-symlinks

I’ll give that a shot—thanks for all the help on this one!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Contributing Walkthrough | RedwoodJS Docs
Contributing : Step-by-Step Walkthrough (with Video) ... Diving into Git and the GitHub workflow can feel intimidating if you haven't experienced it before....
Read more >
Yarn install errors with "ENOENT: no such file or directory
I have a Dockerfile and when I run it locally, everything works fine, however my build through GitHub actions seems to fail, the...
Read more >
the of and to a in for is on s that by this with i you it not
the of and to a in for is on s that by this with i you it not or be are ... nor...
Read more >
how to install express in console Code Example
resources/js/bootstrap.js 8:15-31 Module not found: Error: Can't resolve ... Hands-on GitHub Actions: Implement CI/CD with GitHub Action Workflows for Your ...
Read more >
words-333333.txt
... because 270742935 local 270014141 those 269448880 using 268180843 results ... component 39733007 enable 39699360 exercise 39672754 bug 39664896 santa ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found