swc: Fallback bindings does not support filesystem access in Github Action

Describe the bug

When I compile our project locally it works like a charm:

$  npm run build

> package@0.5.0 build
> rimraf dist && npx swc src --out-dir dist --copy-files

Successfully compiled: 269 files, copied 2 files with swc (115.65ms)

When I compile our project in a GitHub action using the same npm run build command it fails.

Input code

No response

Config

{
  "module": {
    "type": "commonjs",
    "ignoreDynamic": true
  },
  "jsc": {
    "target": "es2018",
    "parser": {
      "syntax": "typescript",
      "dynamicImport": true,
      "decorators": true
    },
    "paths": {
      "@app/*": ["./src/*"],
      "@test/*": ["./test/*"]
    },
    "transform": {
      "legacyDecorator": true,
      "decoratorMetadata": true
    }
  },
  "minify": false
}

Playground link

No response

Expected behavior

SWC compiles our code in a GitHub action

Actual behavior

In the Github Action I get

> server@0.5.0 build
> rimraf dist && npx swc src --out-dir dist --copy-files

Fallback bindings does not support filesystem access. # <-- this message gets repeated a lot, I'd assume 269 times
...

Error: Failed to compile:
... 

long list of files

Version

@swc/core”: “^1.2.244”

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

Most straight forward debugging process is

  1. check if binary is correctly (physically) installed under node_modules
  2. try to require those native bindings directly, and try to invoke few api to see if it’s correctly working

as those are the conditions fallback bindings kick in if any of above fails.