Skip to content
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

Support Node 14 #346

Closed
jmhobbs opened this issue May 18, 2021 · 7 comments · Fixed by #348
Closed

Support Node 14 #346

jmhobbs opened this issue May 18, 2021 · 7 comments · Fixed by #348
Labels
customer reported Tracking: This issue was reported through customer support enhancement Classification: New feature or request github action Classification: Relates to the GitHub Action has workaround Tracking: This issue has an available workaround

Comments

@jmhobbs
Copy link
Contributor

jmhobbs commented May 18, 2021

Some features, like optional chaining, are unsupported in Node 12. This can be problematic because GitHub actions supports Node 14 (14.16.1 at time of writing), leading to a split where run steps are in Node 14, but our action is running on Node 12.

Generally this is not an issue, but can be confusing because a Storybook build will work in a run step, then fail when invoked by the action.

This update is blocked by actions/runner#772, as JavaScript actions do not currently support node14.

The current workaround is to build in a run step to a known directory, then use storybookBuildDir to upload the prebuilt Storybook.

@jmhobbs jmhobbs added enhancement Classification: New feature or request customer reported Tracking: This issue was reported through customer support has workaround Tracking: This issue has an available workaround github action Classification: Relates to the GitHub Action labels May 18, 2021
@jmhobbs
Copy link
Contributor Author

jmhobbs commented May 18, 2021

cc @romain-blatrix

@jmhobbs
Copy link
Contributor Author

jmhobbs commented May 18, 2021

This can also cause issues for compiled packages and bindings, for example node-sass, resulting in errors like:

Module build failed (from ./node_modules/sass-extract-loader/index.js):
Error: Missing binding /home/runner/work/<user>/<repository>/node_modules/node-sass/vendor/linux-x64-72/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 12.x

Found bindings for the following environments:
 - Linux 64-bit with Node.js 14.x

This class of errors can be worked around by using the setup-node action and using Node 12 in the run steps, assuming your code base is compatible with Node 12.

@ThanakritJuthamongkhonTW

Hello @jmhobbs ,

We got the same issue on our ends, would you mind sharing you work around in this thread please?
like your github action workflow file

Thanks in advance

@jmhobbs
Copy link
Contributor Author

jmhobbs commented May 19, 2021

For the issue with compiled packages, not missing language features, the action file would look something like this:

name: 'Chromatic'

on: push

jobs:
  chromatic-deployment:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      ############################################
      # Insert this step before npm / yarn install
      - uses: actions/setup-node@v2
        with:
          node-version: '12'
      ############################################
      - name: Install dependencies
        run: yarn
      - name: Publish to Chromatic
        uses: chromaui/action@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

@ThanakritJuthamongkhonTW

That is working, many thanks @jmhobbs

@yshrsmz
Copy link

yshrsmz commented May 19, 2021

For me above node-version setting does not work, as package.json has the following engine configuration

  "engines": {
    "npm": "please_use_yarn_instead",
    "node": ">=14.15.4"
  },

it would be great if you can support node v14

@ghengeveld
Copy link
Member

This should be fixed with chromatic@5.8.2. Please let us know if it doesn't resolve the problem for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer reported Tracking: This issue was reported through customer support enhancement Classification: New feature or request github action Classification: Relates to the GitHub Action has workaround Tracking: This issue has an available workaround
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants