chromatic-cli icon indicating copy to clipboard operation
chromatic-cli copied to clipboard

"Found invalid package.json" just started appearing this morning

Open dep opened this issue 1 year ago • 10 comments

Very strange as we didn't change anything in our monorepository but this morning all of our Chromatic tasks are failing with the same error:

Run chromaui/action@v1
  with:
    projectToken: ***
    storybookBuildDir: applications/react/modern/template/storybook-static/src
    exitZeroOnChanges: true
✖ Invalid package.json
Found invalid package.json at /home/runner/work/Box/package.json
Make sure this is a valid Node.js package file, is readable, and contains a "scripts" block.

I wonder if there was some sort of transitive dependency bug introduced?

dep avatar Jun 13 '23 10:06 dep

Looks like the Action was update 4 hours ago: https://github.com/chromaui/action - Seems like it might've introduced a regression. Our root-of-repo package.json doesn't need a scripts tag. Instead, it uses nx to execute scripts within the child applications' package.json.

dep avatar Jun 13 '23 11:06 dep

For what it's worth adding an empty scripts tag to my root package.json fixed the issue:

{
  "name": "foo",
  "scripts": {},
  ...
}

dep avatar Jun 13 '23 11:06 dep

We are experiencing the same issue for the last 2 days. Unfortunately, your solution @dep is not resolving it for us so hopefully there will be an update in the action itself that will help in our case.

jamigibbs avatar Jun 15 '23 14:06 jamigibbs

@dep thank you for reporting this issue. We are investigating this. Can you provide us a small reproduction that we can test the action against?

weeksling avatar Jun 15 '23 19:06 weeksling

Ours is a monorepository, so we have a package.json that sits at the root of the repo (with no scripts definition).

We then have a folder system like this:

root: package.json
  applications/react/app-1
      - package.json with "scripts" defined
  applications/react/app-2
      - package.json with "scripts" defined

Then each "app" has its own github action with the following step:

- uses: chromaui/action@v1
  with:
    projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
    storybookBuildDir: 'applications/react/app-1/storybook-static/src'
    exitZeroOnChanges: true

I hope this helps reproduce

dep avatar Jun 16 '23 14:06 dep

Thank you so much! We are looking into this and hope to have a resolution soon!

thafryer avatar Jun 17 '23 02:06 thafryer

hello @thafryer is there any progress on this issue we dont use scripts in our package.json is there a way to run the commande without having scripts filed in the package.json file ?

moussaab-moulim avatar Jan 31 '24 08:01 moussaab-moulim

Same issue here. No scripts in package.json for now we will add.

yuchant avatar Apr 22 '24 20:04 yuchant