Is there a need for a redwood doctor?

The name redwood doctor is silly, but it used at many places, so I am using it here to indicate a consistency checker tool. Here are the needed details

I got in trouble with yarn 3.2, running the yarn rw dev:

/Users/nik/dev/work/redwood/docs/tandem-tutorial-samples/.pnp.cjs:41326
      Error.captureStackTrace(firstError);
            ^

Error: @redwoodjs/cli tried to access @babel/runtime-corejs3, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: @babel/runtime-corejs3 (via "@babel/runtime-corejs3/core-js/object/define-property")
Required by: @redwoodjs/cli@npm:1.0.0 (via /Users/nik/dev/work/redwood/docs/tandem-tutorial-samples/.yarn/cache/@redwoodjs-cli-npm-1.0.0-953424cca7-6795404bd7.zip/node_modules/@redwoodjs/cli/dist/lib/)
...

Clearly, I managed to invoke Plug’nPlay feature without intending so. Like @dom, I am very much looking forward to be able to used (in other words, I am terrified by the sheer size of node_modules and seemingly great likelihood of problems it creates), however, I do not want at this time to push boundaries.

Let me finally explain how did I managed to step in that mud: After many years of fighting with git asymmetry (I will explain this in a minute):

  1. I always create a new “remote” repository using the browser and provide only the README and license files at that time.

  2. Next step is to use git cli in my (local) terminal to clone the “nearly empty” remote remote repository (in a folder having the same name as the remote in Github).

  3. As a result, due to using git clone my two repos, are properly linked.

  4. Finally I clone the actual repo - (in this case RW tutorial app) into a temp folder (not willing that the github related files in my local (step 2) folder get overwritten).

At this point I shoot myself in the foot, when copying everything in the temp folder into my local folder. In that process, I lose all the magic files that handle the yarn behavior.

Most likely, the advice I will get is “do not do such merging” without understanding the underlying folder structure. This leads to my question “Is there a need for a redwood doctor?” - utility that will check the consistency of the RWJS app under development.


git asymmetry

git prefers to create a new remote repository using the browser, while the local is easier done with git cli. I tried many times create both from local terminal, and always fought with “does the remote repository needs to exist first or not”. If this needs more explanations, please let me know.

There’s always a need for a Doctor Wood.

1 Like

Hello, Thomas - I am not getting “your drift”. What is the story behind “Dr. Wood”?

I believe this is an attempt at a pun :sweat_smile:

I suspected that - but will still wait for @noire.munich to explain it to me

At this point I shoot myself in the foot, when copying everything in the temp folder into my local folder. In that process, I lose all the magic files that handle the yarn behavior.

In order to resolve this, I set the finder to “show hidden files” and then copied all files from the temp folder into my local copy of the remote repository.


Summary - be aware of all invisible files and folders that the typical RWJS app uses.

yes it is, a very bad one at it :D, my keyboard still isn’t filtering these :sweat_smile:


Nikolaj, my “drift” arrived before the full content of your post - I’m sorry :bowing_man: .

I’ve had the exact same error in a very different context a month ago, I was upgrading to yarn 3 and trying to figure out why it crashed my github workflows. While debugging there was a step where I mounted a Docker image in the action’s steps - that’s where I got the Error: @redwoodjs/cli tried to access @babel/runtime-corejs3, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound..

I walked away thinking this was an omen of worst, unfruitful debugging to come, and eventually went back to a couple of steps earlier to find a cleaner solution to the problem.

A doctor would have been appreciated, but I’m also not sure if, as a web developer, I’d want such a refined level of information on the intricacies of the framework’s dependencies. I guess the utility would be more useful to the core team/contributors to investigate the issue though, but if I’m rushing for a feature…


This being said, the utility would check the consistency of the files under ./.redwood, right? Would you expect it to check anything else?

Indeed, I would - the area that made me suffer (files in .yarn folder), which would normally be part of of the project created by RW cli, or copied to local project by git clone. As I did manual copy with finder, where the hidden files were not shown, so finder concluded that these do not need to be copied.

In summary - not really critically important. I wrote the article to help someone getting Yarn PnP, without understanding why

1 Like