-
Notifications
You must be signed in to change notification settings - Fork 71
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
Yarn Berry Support #166
Comments
That seems odd, I think we are using https://github.com/loggly/node-loggly-bulk in a fairly straightforward and still the currently recommended way. I don't know too much about Yarn Berry, do have any idea about how to debug it? |
I had another report of this come through on support today. Yarn v2 user as well, same error. |
I suspect this is indeed broken, but only gets surfaced by Yarn 2. We should handle rejected promises globally as a catch-all: process.on('unhandledRejection', error => ...); |
I've released an alpha version which adds a promise rejection handler and replaces the default |
Hi @ghengeveld 👋 Thanks for getting back to me so quickly. I'm now getting this error |
Hi @jayarnielsen, I was able to reproduce and fix the issue with Yarn 2. I've published another alpha which should resolve the issue. Could you verify? Install with |
Probably you're going to run into "Could not find a supported Storybook viewlayer package" now. I'm looking into it. |
@jayarnielsen I've tried getting Yarn 2 to work for a couple hours but it's currently failing at build-storybook which fails with I'm out of ideas right now. I did find this supposed workaround, which might work: |
Maybe babel-loader need to be a dependency and not a devDependency? I'm still wrapping my head around yarn 2's strict dependency requirements. |
This resolver is definitely problematic with yarn's package structure. I wonder if you could parse the project's package.json file instead?
|
I fixed that by using |
@ghengeveld is this issue fixed? |
There's a PR pending for this: #168 |
Hi there, thanks for working on this! Do you have any estimate of when this PR will be merged and chromatic will work with yarn 2? |
I had trouble getting chromatic to work in a yarn 2 repo, as it was failing to run the correct build script. Applying the following patch fixed the problem for me: diff --git a/bin/tasks/build.js b/bin/tasks/build.js
index 1b000848db691ba729a9cce055fe34ae0d68014d..78cae42a284029082602673baef3936ee1c821ac 100644
--- a/bin/tasks/build.js
+++ b/bin/tasks/build.js
@@ -27,10 +27,10 @@ export const setSpawnParams = ctx => {
// Based on https://github.com/mysticatea/npm-run-all/blob/52eaf86242ba408dedd015f53ca7ca368f25a026/lib/run-task.js#L156-L174
const npmExecPath = process.env.npm_execpath;
const isJsPath = typeof npmExecPath === 'string' && /\.m?js/.test(path.extname(npmExecPath));
- const isYarn = npmExecPath && path.basename(npmExecPath) === 'yarn.js';
+ const isYarn = npmExecPath && path.basename(npmExecPath).startsWith('yarn');
ctx.spawnParams = {
command: isJsPath ? process.execPath : npmExecPath || 'npm',
- clientArgs: [isJsPath ? npmExecPath : '', isYarn ? '' : 'run', '--silent'].filter(Boolean),
+ clientArgs: [isJsPath ? npmExecPath : '', isYarn ? '' : 'run', isYarn ? '' : '--silent'].filter(Boolean),
scriptArgs: [
ctx.options.buildScriptName,
isYarn ? '' : '--', I assume this breaks yarn 1 compatibility though, so it may need some modifications. I did not run into the OP's issue, so that may have fixed itself? |
The original error I posted about seems to have sorted itself out. However I'm still running into issues using chromatic with a yarn 2 repo. It seems to have issues finding the version of storybook, even when I use the env variable TypeError: ✖ Failed to build Storybook My workflow looks like this: - name: Run Chromatic
uses: chromaui/action@v1
with:
token: ${{ secrets.GH_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
exitZeroOnChanges: true
allowConsoleErrors: true
buildScriptName: "build:storybook"
env:
CHROMATIC_STORYBOOK_VERSION: react@6.0.28 Here's the output I'm getting from the action: {
"timestamp": "2020-11-17T19:10:10.270Z",
"sessionId": "8ff6ec28-8909-4de3-918c-c1436647afb4",
"gitVersion": "2.29.2",
"nodePlatform": "linux",
"nodeVersion": "12.13.1",
"packageName": "chromatic",
"packageVersion": "5.4.0",
"storybook": {
"viewLayer": "react",
"addons": []
},
"flags": {
"projectToken": "***",
"buildScriptName": "build:storybook",
"fromCI": true,
"interactive": false,
"exitZeroOnChanges": true,
"exitOnceUploaded": false,
"allowConsoleErrors": true
},
"buildScript": "build-storybook -c .storybook -o ./build",
"errorType": "TypeError",
"errorMessage": "✖ Failed to build Storybook"
} |
Is this still an issue for folks? |
Going to close for now, let us know if there is still a problem! |
+1 from https://app.intercom.com/a/apps/zj7sn9j1/inbox/inbox/conversation/27253945133#part_id=comment-27253945133-10324495908 -- this issue may need reopened @tmeasday |
I'm trying to reproduce this. I made a new storybook repoduction with pnp enabled. I immediately ran into a problem getting storybook to run. Next I installed chromatic, and my .pnp.cjs file got overwritten, breaking storybook again. I applied my fix again, and got storybook to run again. Now I try and run the chromatic command, but this fails.
|
@ghengeveld You recently made a package |
Currently running to the same issue. It seems that this might be supported in Yarn 3.x in the future but it's still in draft yarnpkg/berry#2161 |
I am also getting the following error;
We run this in CircleCI. In the meantime, we've got the following step in the job that switches to using the
|
|
Not ideal, hopefully we can figure out a better fix. |
@zol same, we split chromatic into its own job that runs parallel so our other jobs can run with zero install. Best we could figure out until this is fixed. |
A workaround for Yarn 2 / PnP was outlined by @cmbirk here: https://github.com/CrossroadsCX/action/blob/afe74f34a1608ecb8571b65163a7695ecf1af0d4/README.md#yarn-2-support We still plan to have native support for Yarn 2 / PnP, but this might help anyone who needs a quick workaround. |
A better workaround for anyone coming across this #578 (comment). No need to change the node linker or reinstall the dependencies. It then works fine with pnp zero installs. |
The Chromatic CLI seems to have issues running in a Yarn v2 project. Whenever we run
yarn chromatic
we get this error:Wondering if this is a known issue with Yarn 2 or something else.
┆Issue is synchronized with this Asana task by Unito
The text was updated successfully, but these errors were encountered: