trigger.dev icon indicating copy to clipboard operation
trigger.dev copied to clipboard

bug: EWORKSPACESCONFIG workspaces config expects an Array in yarn package.json with nohoist

Open goleary opened this issue 1 year ago • 2 comments

Provide environment information

System: OS: macOS 15.1 CPU: (10) arm64 Apple M2 Pro Memory: 89.38 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node Yarn: 1.22.19 - ~/Documents/GitHub/andytown/node_modules/.bin/yarn npm: 10.5.0 - ~/.nvm/versions/node/v20.12.2/bin/npm pnpm: 9.10.0 - ~/Library/pnpm/pnpm Watchman: 2024.09.09.00 - /opt/homebrew/bin/watchman

Describe the bug

In a project with a valid yarn packages.json that has a valid workspaces config:

  "workspaces": {
    "nohoist": [
      "react"
    ]
  },

an error is produced when try to run trigger dev

Reproduction repo

below

To reproduce

  1. create new a new trigger project
  2. Add workspaces object as below
  ...
  "workspaces": {
    "nohoist": [
      "react"
    ]
  },
  ...
}
  1. run npx trigger.dev@latest dev

error=>

npm ERR! code EWORKSPACESCONFIG
npm ERR! workspaces config expects an Array

Additional information

Would be sweet if y'all provided a template stackblitz/codesandbox in this issue template for augmentation

goleary avatar Jan 09 '25 23:01 goleary

This looks like it's trying to use npm and not yarn to run the resolved the dependencies.

Do you have a yarn lock file? If you do we should detect that you're using yarn and install packages with that.

If you don't have a yarn lock file we use the package manager that you run the command with, e.g. npx = npm. But it looks like with yarn 1.x there's no equivalent of npx… 🤦

matt-aitken avatar Jan 13 '25 15:01 matt-aitken

Yeah, there is a yarn.lock file at the root of the repo. I started running the commands using the locally installed version, via yarn trigger dev etc, but doing so doesn't resolve my issue, the package.json still seem to not be parsable by trigger :/

I also tried running yarn trigger deploy from the root of the repo (instead of from the sub app where trigger is being used) and specifying the config and env, but when i do this I run into this error:

#18 ERROR: process "/bin/sh -c node node_modules/prisma/build/index.js generate --schema=./prisma/schema.prisma --generator=client" did not complete successfully: exit code: 1
...
#18 0.996 error Running this command will add the dependency to the workspace root rather than the workspace itself, which might not be what you want - if you really meant it, make it explicit by running this command again with the -W flag (or --ignore-workspace-root-check).

goleary avatar Jan 15 '25 23:01 goleary