redwood: [FAQ] `yarn rw link` tracking issues and common problems for contributing

Creating this issue to highlight commonly faced issues, and suggested solutions, when trying to to contribute using yarn rwt link

If you find an issue, please comment here - and please include if you found a way around the problem as well. The purpose of this issue being a reference, so you can get on with contributing 🚀

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Issue

Yarn install fails during rwt link with the error:

error An unexpected error occurred: "expected workspace package to exist for \"xxxx"".

xxx could be a handful of modules - but commonly @babel/cli.

This does not happen in all projects, but can happen, typically after an upgrade.

Solution

This is a very painful bug within yarn, and something to do wth yarn’s resolution strategy 🤷. See here: https://github.com/yarnpkg/yarn/issues/7807

Step 1: Remove all node_modules

rm -rf node_modules api/node_modules web/node_modules

Step 2: Set yarn policy to 1.18

yarn policies set-version 1.18.0

Step 3: Reinstall node_modules

yarn install --ignore-engines

Step 4: Undo the policy change

rm -rf .yarnrc .yarn/

Step 5: Re run link

yarn rwt link [RW_PATH]

rwt link fails due to type issue

packages/api/src/logger/index.ts:353:30 - error TS7053: Element implicitly has an 'any' type because expression of type '"_clientVersion"' can't be used to index type 'PrismaClient<PrismaClientOptions, never, RejectOnNotFound | RejectPerOperation | undefined>'.
      Property '_clientVersion' does not exist on type 'PrismaClient<PrismaClientOptions, never, RejectOnNotFound | RejectPerOperation | undefined>'.

353     prisma: { clientVersion: config.db['_clientVersion'] },
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/api/src/logger/index.ts:358:21 - error TS2345: Argument of type '"query"' is not assignable to parameter of type '"beforeExit"'.

358       config.db.$on(level, (queryEvent: QueryEvent) => {
                        ~~~~~

packages/api/src/logger/index.ts:372:21 - error TS2345: Argument of type '"info" | "warn" | "error"' is not assignable to parameter of type '"beforeExit"'.
  Type '"info"' is not assignable to type '"beforeExit"'.

372       config.db.$on(level, (logEvent: LogEvent) => {
                        ~~~~~

Solution

This happens when the prisma types go out of sync for some reason.

Steps to resolve:

  1. Make sure you’ve pulled the latest code for the framework git pull origin main
  2. In your framework repo run (warn: this will wipe out your changes!!)
git clean -dfx -e .env
  1. Reinstall node_modules
yarn install

You should be able to run rwt link successfully on your project again now

Hey @LBrian, this is likely due to the structural changes we’re making to redwood at the moment. Steps to try and fix:

Assuming you’ve pulled main, and done a yarn install in the redwood folder:

  • Make sure you don’t have the eslint-redwood-plugin folder in your packages/ folder (in the framework repo)

The issue is resolved by running in both redwoodjs/redwood and my-rr-app folders then yarn again

git clean -dfx -e .env

It’s just that the paths we link to has changed. It won’t be an issue if your project is v0.34 or higher

Hey @LBrian, this is likely due to the structural changes we’re making to redwood at the moment. Steps to try and fix:

Assuming you’ve pulled main, and done a yarn install in the redwood folder:

  • Make sure you don’t have the eslint-redwood-plugin folder in your packages/ folder (in the framework repo)

Issue

node-gyp-build, yarn install --pure-lockfile --check-files failed:

[5/5] 🔨  Building fresh packages...
[1/21] â ‚ @prisma/engines
[2/21] â ‚ browser-tabs-lock
[3/21] â ‚ core-js
[4/21] â ‚ bufferutil
error /Users/dominicsaadi/projects/redwood/_sandbox/2609.callingmedic911:wrap-routes-with-set-in-scaffold/node_modules/bufferutil: Command failed.
Exit code: 127
Command: node-gyp-build
Arguments:




rwt link [RW_PATH]

Run your local version of redwood in this project

Options:
      --help     Show help                                             [boolean]
      --version  Show version number                                   [boolean]
  -c, --clean    Clean the redwood dist folders first. [boolean] [default: true]
  -w, --watch    Build and watch the supplied redwood repo
                                                       [boolean] [default: true]

Error: Command failed with exit code 127: yarn install --pure-lockfile --check-files
    at makeError (/Users/dominicsaadi/projects/redwood/_sandbox/2609.callingmedic911:wrap-routes-with-set-in-scaffold/node_modules/execa/lib/error.js:59:11)
    at handlePromise (/Users/dominicsaadi/projects/redwood/_sandbox/2609.callingmedic911:wrap-routes-with-set-in-scaffold/node_modules/execa/index.js:114:26)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Object.rwtLink [as handler] (/Users/dominicsaadi/projects/redwood/_sandbox/2609.callingmedic911:wrap-routes-with-set-in-scaffold/node_modules/@redwoodjs/cli/dist/redwood-tools.js:239:3) {
  shortMessage: 'Command failed with exit code 127: yarn install --pure-lockfile --check-files',
  command: 'yarn install --pure-lockfile --check-files',
  exitCode: 127,
  signal: undefined,
  signalDescription: undefined,
  stdout: undefined,
  stderr: undefined,
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
fish: Job 1, 'yarn rwt link &' has ended

Solution

Install node-gyp-build globally:

npm install -g node-gyp-build