nektos / act

Run your GitHub Actions locally πŸš€
https://nektosact.com
MIT License
54.36k stars 1.36k forks source link

Local Actions - Error: Cannot find module - MODULE_NOT_FOUND #2384

Open smashedr opened 3 months ago

smashedr commented 3 months ago

Bug report info

act version:            0.2.64
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 6
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
Config files:
        /home/shane/.actrc:
                -P ubuntu-latest=catthehacker/ubuntu:act-latest
                -P ubuntu-22.04=catthehacker/ubuntu:act-22.04
                -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
        Go version:            go1.21.11
        Module path:           github.com/nektos/act
        Main version:          (devel)
        Main path:             github.com/nektos/act
        Main checksum:
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -ldflags:             -s -w -X main.version=0.2.64 -X main.commit=aa54ea933591a57d1179c2691a57f2017aa855e5 -X main.date=2024-07-01T02:21:46Z -X main.builtBy=goreleaser
                CGO_ENABLED:          0
                GOARCH:               amd64
                GOOS:                 linux
                GOAMD64:              v1
                vcs:                  git
                vcs.revision:         aa54ea933591a57d1179c2691a57f2017aa855e5
                vcs.time:             2024-07-01T02:21:27Z
                vcs.modified:         false
Docker Engine:
        Engine version:        27.0.3
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         systemd
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Ubuntu 22.04.4 LTS
        OS type:               linux
        OS version:            22.04
        OS arch:               x86_64
        OS kernel:             5.15.0-112-generic
        OS CPU:                6
        OS memory:             3875 MB
        Security options:
                name=apparmor
                name=seccomp,profile=builtin
                name=cgroupns

Command used with act

0 shane@jammy [/home/shane/docker/test2]$ act
INFO[0000] Using docker host 'unix:///var/run/docker.sock', and daemon socket 'unix:///var/run/docker.sock'
[Test/Test] πŸš€  Start image=catthehacker/ubuntu:act-latest
[Test/Test]   🐳  docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Test/Test]   🐳  docker create image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Test/Test]   🐳  docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Test/Test] ⭐ Run Main Checkout
[Test/Test]   🐳  docker cp src=/home/shane/docker/test2/. dst=/home/shane/docker/test2
[Test/Test]   βœ…  Success - Main Checkout
[Test/Test] ⭐ Run Main Test Action
[Test/Test]   🐳  docker exec cmd=[node /home/shane/docker/test2/parse-issue-form-action/dist/index.js] user= workdir=
| node:internal/modules/cjs/loader:1143
|   throw err;
|   ^
|
| Error: Cannot find module '/home/shane/docker/test2/parse-issue-form-action/dist/index.js'
|     at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
|     at Module._load (node:internal/modules/cjs/loader:981:27)
|     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
|     at node:internal/main/run_main_module:28:49 {
|   code: 'MODULE_NOT_FOUND',
|   requireStack: []
| }
|
| Node.js v18.20.3
[Test/Test]   ❌  Failure - Main Test Action
[Test/Test] exitcode '1': failure
[Test/Test] 🏁  Job failed
Error: Job 'Test' failed

Describe issue

All my local actions started throwing this error (based on the respective local action being used):

Error: Cannot find module '/home/shane/docker/test2/parse-issue-form-action/dist/index.js'

But the file is clearly there:

shane@jammy [/home/shane/docker/test2]$ stat /home/shane/docker/test2/parse-issue-form-action/dist/index.js
  File: /home/shane/docker/test2/parse-issue-form-action/dist/index.js

action.yml

runs:
  using: "node20"
  main: "dist/index.js"

This was previously working working just fine. I setup an all new test to make sure it was not something with my environment, but got the exact same error. This is the sample test I setup:

Note: Previously I place all my local actions in the ./.github folder, example: .github/parse-issue-form-action I have tried this new test in both the ./.github directory and current working directory, but both throw the same error.

Additionally, I was also previously able to run my actions from source, by setting my main in action.yml to src/index.js with a node_modules in the current working directory, but doing that also fails with the error Error: Cannot find module '@actions/core' when npm ls clearly shows it installed.

0 shane@jammy [/home/shane/docker/test2]$ npm ls
test2@ /home/shane/docker/test2
β”œβ”€β”€ @actions/core@1.10.1
β”œβ”€β”€ @actions/github@6.0.0
β”œβ”€β”€ @vercel/ncc@0.38.1
└── prettier@3.3.2

Again, all this was previously working, just days ago, and now all fails. Did something change?

Link to GitHub repository

No response

Workflow content

name: "Test"

on:
  workflow_dispatch:

jobs:
  test:
    name: "Test"
    runs-on: ubuntu-latest
    timeout-minutes: 5

    steps:
      - name: "Checkout"
        uses: actions/checkout@v4

      - name: "Test Action"
        uses: ./parse-issue-form-action
        with:
          token: test
          body: test

Relevant log output

0 shane@jammy [/home/shane/docker/test2]$ act -v
DEBU[0000] Handling container host and socket
DEBU[0000] Defaulting container socket to DOCKER_HOST
INFO[0000] Using docker host 'unix:///var/run/docker.sock', and daemon socket 'unix:///var/run/docker.sock'
DEBU[0000] Loading environment from /home/shane/docker/test2/.env
DEBU[0000] Loading action inputs from /home/shane/docker/test2/.input
DEBU[0000] Loading secrets from /home/shane/docker/test2/.secrets
DEBU[0000] Loading vars from /home/shane/docker/test2/.vars
DEBU[0000] Evaluated matrix inclusions: map[]
DEBU[0000] Loading workflows from '/home/shane/docker/test2/.github/workflows'
DEBU[0000] Loading workflows recursively
DEBU[0000] Found workflow 'test.yaml' in '/home/shane/docker/test2/.github/workflows/test.yaml'
DEBU[0000] Reading workflow '/home/shane/docker/test2/.github/workflows/test.yaml'
DEBU[0000] Preparing plan with all jobs
DEBU[0000] Using the only detected workflow event: workflow_dispatch
DEBU[0000] Planning jobs for event: workflow_dispatch
DEBU[0000] gc: 2024-07-04 10:28:29.799615921 +0000 UTC m=+0.006103909  module=artifactcache
DEBU[0000] Plan Stages: [0xc000011080]
DEBU[0000] Stages Runs: [Test]
DEBU[0000] Job.Name: Test
DEBU[0000] Job.RawNeeds: {0 0    <nil> []    0 0}
DEBU[0000] Job.RawRunsOn: {8 0 !!str ubuntu-latest  <nil> []    9 14}
DEBU[0000] Job.Env: {0 0    <nil> []    0 0}
DEBU[0000] Job.If: {0 0  success()  <nil> []    0 0}
DEBU[0000] Job.Steps: Checkout
DEBU[0000] Job.Steps: Test Action
DEBU[0000] Job.TimeoutMinutes: 5
DEBU[0000] Job.Services: map[]
DEBU[0000] Job.Strategy: <nil>
DEBU[0000] Job.RawContainer: {0 0    <nil> []    0 0}
DEBU[0000] Job.Defaults.Run.Shell:
DEBU[0000] Job.Defaults.Run.WorkingDirectory:
DEBU[0000] Job.Outputs: map[]
DEBU[0000] Job.Uses:
DEBU[0000] Job.With: map[]
DEBU[0000] Job.Result:
DEBU[0000] Empty Strategy, matrixes=[map[]]
DEBU[0000] Job Matrices: [map[]]
DEBU[0000] Runner Matrices: map[]
DEBU[0000] Final matrix after applying user inclusions '[map[]]'
DEBU[0000] Conditional GET for notices etag=c046dd62-836c-474d-aec1-d0488990efe3
DEBU[0000] Loading revision from git directory
DEBU[0000] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
DEBU[0000] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
DEBU[0000] using github ref: refs/heads/test
DEBU[0000] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
DEBU[0000] Detected CPUs: 6
[Test/Test] [DEBUG] evaluating expression 'success()'
[Test/Test] [DEBUG] expression 'success()' evaluated to 'true'
[Test/Test] πŸš€  Start image=catthehacker/ubuntu:act-latest
DEBU[0000] Parallel tasks (0) below minimum, setting to 1
[Test/Test]   🐳  docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Test/Test] [DEBUG]   🐳  docker pull catthehacker/ubuntu:act-latest
[Test/Test] [DEBUG] pulling image 'docker.io/catthehacker/ubuntu:act-latest' ()
DEBU[0000] Saving notices etag=c046dd62-836c-474d-aec1-d0488990efe3
DEBU[0000] No new notices
[Test/Test] [DEBUG] Pulling from catthehacker/ubuntu :: act-latest
[Test/Test] [DEBUG] Digest: sha256:ee8404ebef08b77dc1523ea070aab3fef428459753d2da0246c1334ccc577e50 ::
[Test/Test] [DEBUG] Status: Image is up to date for catthehacker/ubuntu:act-latest ::
[Test/Test] [DEBUG] Removed container: 913881f078562920bca4cd55dbe81d3864e080b687438eca84f2c30039d4c193
[Test/Test] [DEBUG]   🐳  docker volume rm act-Test-Test-e9ad80ce940953c648e99da9e7b82d7b326237fe669778237ac8844052b293ad
[Test/Test] [DEBUG]   🐳  docker volume rm act-Test-Test-e9ad80ce940953c648e99da9e7b82d7b326237fe669778237ac8844052b293ad-env
DEBU[0001] Parallel tasks (0) below minimum, setting to 1
[Test/Test]   🐳  docker create image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Test/Test] [DEBUG] Common container.Config ==> &{Hostname: Domainname: User: AttachStdin:false AttachStdout:false AttachStderr:false ExposedPorts:map[] Tty:true OpenStdin:false StdinOnce:false Env:[RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_ARCH=X64 RUNNER_TEMP=/tmp LANG=C.UTF-8] Cmd:[] Healthcheck:<nil> ArgsEscaped:false Image:catthehacker/ubuntu:act-latest Volumes:map[] WorkingDir:/home/shane/docker/test2 Entrypoint:[] NetworkDisabled:false MacAddress: OnBuild:[] Labels:map[] StopSignal: StopTimeout:<nil> Shell:[]}
[Test/Test] [DEBUG] Common container.HostConfig ==> &{Binds:[/var/run/docker.sock:/var/run/docker.sock] ContainerIDFile: LogConfig:{Type: Config:map[]} NetworkMode:host PortBindings:map[] RestartPolicy:{Name: MaximumRetryCount:0} AutoRemove:false VolumeDriver: VolumesFrom:[] ConsoleSize:[0 0] Annotations:map[] CapAdd:[] CapDrop:[] CgroupnsMode: DNS:[] DNSOptions:[] DNSSearch:[] ExtraHosts:[] GroupAdd:[] IpcMode: Cgroup: Links:[] OomScoreAdj:0 PidMode: Privileged:false PublishAllPorts:false ReadonlyRootfs:false SecurityOpt:[] StorageOpt:map[] Tmpfs:map[] UTSMode: UsernsMode: ShmSize:0 Sysctls:map[] Runtime: Isolation: Resources:{CPUShares:0 Memory:0 NanoCPUs:0 CgroupParent: BlkioWeight:0 BlkioWeightDevice:[] BlkioDeviceReadBps:[] BlkioDeviceWriteBps:[] BlkioDeviceReadIOps:[] BlkioDeviceWriteIOps:[] CPUPeriod:0 CPUQuota:0 CPURealtimePeriod:0 CPURealtimeRuntime:0 CpusetCpus: CpusetMems: Devices:[] DeviceCgroupRules:[] DeviceRequests:[] KernelMemory:0 KernelMemoryTCP:0 MemoryReservation:0 MemorySwap:0 MemorySwappiness:<nil> OomKillDisable:<nil> PidsLimit:<nil> Ulimits:[] CPUCount:0 CPUPercent:0 IOMaximumIOps:0 IOMaximumBandwidth:0} Mounts:[{Type:volume Source:act-toolcache Target:/opt/hostedtoolcache ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>} {Type:volume Source:act-Test-Test-e9ad80ce940953c648e99da9e7b82d7b326237fe669778237ac8844052b293ad-env Target:/var/run/act ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>} {Type:volume Source:act-Test-Test-e9ad80ce940953c648e99da9e7b82d7b326237fe669778237ac8844052b293ad Target:/home/shane/docker/test2 ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>}] MaskedPaths:[] ReadonlyPaths:[] Init:<nil>}
[Test/Test] [DEBUG] input.NetworkAliases ==> [Test]
[Test/Test] [DEBUG] Created container name=act-Test-Test-e9ad80ce940953c648e99da9e7b82d7b326237fe669778237ac8844052b293ad id=2c0977f743107bacb06528b0a6d3ed61c8d8bf3e7fbf1be88fc905b41a8bec80 from image catthehacker/ubuntu:act-latest (platform: )
[Test/Test] [DEBUG] ENV ==> [RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_ARCH=X64 RUNNER_TEMP=/tmp LANG=C.UTF-8]
[Test/Test]   🐳  docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Test/Test] [DEBUG] Starting container: 2c0977f743107bacb06528b0a6d3ed61c8d8bf3e7fbf1be88fc905b41a8bec80
[Test/Test] [DEBUG] Started container: 2c0977f743107bacb06528b0a6d3ed61c8d8bf3e7fbf1be88fc905b41a8bec80
[Test/Test] [DEBUG] Writing entry to tarball workflow/event.json len:2
[Test/Test] [DEBUG] Writing entry to tarball workflow/envs.txt len:0
[Test/Test] [DEBUG] Extracting content to '/var/run/act/'
[Test/Test] [DEBUG] Loading revision from git directory
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
[Test/Test] [DEBUG] using github ref: refs/heads/test
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] Loading revision from git directory
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
[Test/Test] [DEBUG] using github ref: refs/heads/test
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] Skipping local actions/checkout because workdir was already copied
[Test/Test] [DEBUG] skip pre step for 'Checkout': no action model available
[Test/Test] [DEBUG] Loading revision from git directory
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
[Test/Test] [DEBUG] using github ref: refs/heads/test
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] Skipping local actions/checkout because workdir was already copied
[Test/Test] [DEBUG] Loading revision from git directory
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
[Test/Test] [DEBUG] using github ref: refs/heads/test
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] Loading revision from git directory
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
[Test/Test] [DEBUG] using github ref: refs/heads/test
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] Loading revision from git directory
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
[Test/Test] [DEBUG] using github ref: refs/heads/test
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] setupEnv => map[ACT:true ACTIONS_CACHE_URL:http://192.168.1.15:37105/ CI:true GITHUB_ACTION:0 GITHUB_ACTIONS:true GITHUB_ACTION_PATH: GITHUB_ACTION_REF:v4 GITHUB_ACTION_REPOSITORY:actions/checkout GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_BASE_REF: GITHUB_EVENT_NAME:workflow_dispatch GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:test GITHUB_REF:refs/heads/test GITHUB_REF_NAME:test GITHUB_REF_TYPE:branch GITHUB_REPOSITORY:smashedr/test2 GITHUB_REPOSITORY_OWNER:smashedr GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:78d28bb355485dea658d3ad636fc0dcda714c9e2 GITHUB_WORKFLOW:Test GITHUB_WORKSPACE:/home/shane/docker/test2 ImageOS:ubuntu20 RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID:]
[Test/Test] [DEBUG] Loading revision from git directory
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
[Test/Test] [DEBUG] using github ref: refs/heads/test
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] Loading revision from git directory
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
[Test/Test] [DEBUG] using github ref: refs/heads/test
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] evaluating expression ''
[Test/Test] [DEBUG] expression '' evaluated to 'true'
[Test/Test] ⭐ Run Main Checkout
[Test/Test] [DEBUG] Writing entry to tarball workflow/outputcmd.txt len:0
[Test/Test] [DEBUG] Writing entry to tarball workflow/statecmd.txt len:0
[Test/Test] [DEBUG] Writing entry to tarball workflow/pathcmd.txt len:0
[Test/Test] [DEBUG] Writing entry to tarball workflow/envs.txt len:0
[Test/Test] [DEBUG] Writing entry to tarball workflow/SUMMARY.md len:0
[Test/Test] [DEBUG] Extracting content to '/var/run/act'
[Test/Test] [DEBUG] Loading revision from git directory
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
[Test/Test] [DEBUG] using github ref: refs/heads/test
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] Loading revision from git directory
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
[Test/Test] [DEBUG] using github ref: refs/heads/test
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test]   🐳  docker cp src=/home/shane/docker/test2/. dst=/home/shane/docker/test2
[Test/Test] [DEBUG] Writing tarball /tmp/act2786874287 from /home/shane/docker/test2/.
[Test/Test] [DEBUG] Stripping prefix:/home/shane/docker/test2/ src:/home/shane/docker/test2/.
[Test/Test] [DEBUG] Extracting content from '/tmp/act2786874287' to '/home/shane/docker/test2'
[Test/Test]   βœ…  Success - Main Checkout
[Test/Test] [DEBUG] Loading revision from git directory
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
[Test/Test] [DEBUG] using github ref: refs/heads/test
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] Loading revision from git directory
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
[Test/Test] [DEBUG] using github ref: refs/heads/test
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] Loading revision from git directory
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
[Test/Test] [DEBUG] using github ref: refs/heads/test
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] setupEnv => map[ACT:true ACTIONS_CACHE_URL:http://192.168.1.15:37105/ CI:true GITHUB_ACTION:1 GITHUB_ACTIONS:true GITHUB_ACTION_PATH: GITHUB_ACTION_REF: GITHUB_ACTION_REPOSITORY: GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_BASE_REF: GITHUB_EVENT_NAME:workflow_dispatch GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:test GITHUB_REF:refs/heads/test GITHUB_REF_NAME:test GITHUB_REF_TYPE:branch GITHUB_REPOSITORY:smashedr/test2 GITHUB_REPOSITORY_OWNER:smashedr GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:78d28bb355485dea658d3ad636fc0dcda714c9e2 GITHUB_WORKFLOW:Test GITHUB_WORKSPACE:/home/shane/docker/test2 INPUT_BODY:test INPUT_TOKEN:test ImageOS:ubuntu20 RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID:]
[Test/Test] [DEBUG] Loading revision from git directory
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
[Test/Test] [DEBUG] using github ref: refs/heads/test
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] Loading revision from git directory
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
[Test/Test] [DEBUG] using github ref: refs/heads/test
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] evaluating expression ''
[Test/Test] [DEBUG] expression '' evaluated to 'true'
[Test/Test] ⭐ Run Main Test Action
[Test/Test] [DEBUG] Writing entry to tarball workflow/outputcmd.txt len:0
[Test/Test] [DEBUG] Writing entry to tarball workflow/statecmd.txt len:0
[Test/Test] [DEBUG] Writing entry to tarball workflow/pathcmd.txt len:0
[Test/Test] [DEBUG] Writing entry to tarball workflow/envs.txt len:0
[Test/Test] [DEBUG] Writing entry to tarball workflow/SUMMARY.md len:0
[Test/Test] [DEBUG] Extracting content to '/var/run/act'
[Test/Test] [DEBUG] Read action &{Parse Issue Form Action Shane Parse GitHub Issue Forms Action map[body:{Issue Body true } token:{GitHub Token from secrets.GITHUB_TOKEN true }] map[] {node20 map[] dist/index.js  always()  always()   [] []} {green file-text}} from 'Unknown'
[Test/Test] [DEBUG] About to run action &{Parse Issue Form Action Shane Parse GitHub Issue Forms Action map[body:{Issue Body true } token:{GitHub Token from secrets.GITHUB_TOKEN true }] map[] {node20 map[] dist/index.js  always()  always()   [] []} {green file-text}}
[Test/Test] [DEBUG] Loading revision from git directory
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
[Test/Test] [DEBUG] using github ref: refs/heads/test
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] Loading revision from git directory
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
[Test/Test] [DEBUG] using github ref: refs/heads/test
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] type=local-action actionDir=/home/shane/docker/test2/parse-issue-form-action actionPath= workdir=/home/shane/docker/test2 actionCacheDir=/home/shane/.cache/act actionName=./parse-issue-form-action containerActionDir=/home/shane/docker/test2/parse-issue-form-action
[Test/Test] [DEBUG] executing remote job container: [node /home/shane/docker/test2/parse-issue-form-action/dist/index.js]
[Test/Test]   🐳  docker exec cmd=[node /home/shane/docker/test2/parse-issue-form-action/dist/index.js] user= workdir=
[Test/Test] [DEBUG] Exec command '[node /home/shane/docker/test2/parse-issue-form-action/dist/index.js]'
[Test/Test] [DEBUG] Working directory '/home/shane/docker/test2'
| node:internal/modules/cjs/loader:1143
|   throw err;
|   ^
|
| Error: Cannot find module '/home/shane/docker/test2/parse-issue-form-action/dist/index.js'
|     at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
|     at Module._load (node:internal/modules/cjs/loader:981:27)
|     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
|     at node:internal/main/run_main_module:28:49 {
|   code: 'MODULE_NOT_FOUND',
|   requireStack: []
| }
|
| Node.js v18.20.3
[Test/Test]   ❌  Failure - Main Test Action
[Test/Test] exitcode '1': failure
[Test/Test] [DEBUG] skipping post step for 'Checkout': no action model available
[Test/Test] 🏁  Job failed
[Test/Test] [DEBUG] Loading revision from git directory
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
[Test/Test] [DEBUG] HEAD points to '78d28bb355485dea658d3ad636fc0dcda714c9e2'
[Test/Test] [DEBUG] using github ref: refs/heads/test
[Test/Test] [DEBUG] Found revision: 78d28bb355485dea658d3ad636fc0dcda714c9e2
Error: Job 'Test' failed

Additional information

The index.js has was reduced to just this for the test:

core = require('@actions/core')

;(async () => {
    try {
        console.log('success')
    } catch (e) {
        core.debug(e)
        core.info(e.message)
        core.setFailed(e.message)
    }
})()
smashedr commented 3 months ago

I was so confused why something that worked just days ago, stopped working today, I did more digging. The only thing I could find that changed locally from before/after was an apt upgrade. This is the log from that upgrade if useful:

Start-Date: 2024-07-03  02:05:36
Commandline: apt upgrade openssh-server
Requested-By: shane (1000)
Install: linux-modules-5.15.0-113-generic:amd64 (5.15.0-113.123, automatic)
Install: linux-headers-5.15.0-113:amd64 (5.15.0-113.123, automatic)
Install: linux-modules-extra-5.15.0-113-generic:amd64 (5.15.0-113.123, automatic)
Install: linux-headers-5.15.0-113-generic:amd64 (5.15.0-113.123, automatic)
Install: linux-image-5.15.0-113-generic:amd64 (5.15.0-113.123, automatic)
Upgrade: tailscale:amd64 (1.68.1, 1.68.2)
Upgrade: libcups2:amd64 (2.4.1op1-1ubuntu4.8, 2.4.1op1-1ubuntu4.10)
Upgrade: containerd.io:amd64 (1.6.33-1, 1.7.18-1)
Upgrade: docker-compose-plugin:amd64 (2.27.1-1~ubuntu.22.04~jammy, 2.28.1-1~ubuntu.22.04~jammy)
Upgrade: docker-ce-cli:amd64 (5:26.1.4-1~ubuntu.22.04~jammy, 5:27.0.3-1~ubuntu.22.04~jammy)
Upgrade: openssh-client:amd64 (1:8.9p1-3ubuntu0.7, 1:8.9p1-3ubuntu0.10)
Upgrade: linux-headers-generic:amd64 (5.15.0.112.112, 5.15.0.113.113)
Upgrade: pgadmin4-web:amd64 (8.8, 8.9)
Upgrade: google-chrome-stable:amd64 (126.0.6478.114-1, 126.0.6478.126-1)
Upgrade: libcdio19:amd64 (2.1.0-3build1, 2.1.0-3ubuntu0.2)
Upgrade: openssh-server:amd64 (1:8.9p1-3ubuntu0.7, 1:8.9p1-3ubuntu0.10)
Upgrade: pgadmin4:amd64 (8.8, 8.9)
Upgrade: linux-generic:amd64 (5.15.0.112.112, 5.15.0.113.113)
Upgrade: wget:amd64 (1.21.2-2ubuntu1, 1.21.2-2ubuntu1.1)
Upgrade: docker-buildx-plugin:amd64 (0.14.1-1~ubuntu.22.04~jammy, 0.15.1-1~ubuntu.22.04~jammy)
Upgrade: libruby3.0:amd64 (3.0.2-7ubuntu2.6, 3.0.2-7ubuntu2.7)
Upgrade: docker-ce:amd64 (5:26.1.4-1~ubuntu.22.04~jammy, 5:27.0.3-1~ubuntu.22.04~jammy)
Upgrade: ubuntu-pro-client-l10n:amd64 (32.3~22.04, 32.3.1~22.04)
Upgrade: libssl3:amd64 (3.0.2-0ubuntu1.15, 3.0.2-0ubuntu1.16)
Upgrade: docker-ce-rootless-extras:amd64 (5:26.1.4-1~ubuntu.22.04~jammy, 5:27.0.3-1~ubuntu.22.04~jammy)
Upgrade: ruby3.0-dev:amd64 (3.0.2-7ubuntu2.6, 3.0.2-7ubuntu2.7)
Upgrade: ruby3.0-doc:amd64 (3.0.2-7ubuntu2.6, 3.0.2-7ubuntu2.7)
Upgrade: pgadmin4-desktop:amd64 (8.8, 8.9)
Upgrade: libssl-dev:amd64 (3.0.2-0ubuntu1.15, 3.0.2-0ubuntu1.16)
Upgrade: linux-image-generic:amd64 (5.15.0.112.112, 5.15.0.113.113)
Upgrade: ruby3.0:amd64 (3.0.2-7ubuntu2.6, 3.0.2-7ubuntu2.7)
Upgrade: openssh-sftp-server:amd64 (1:8.9p1-3ubuntu0.7, 1:8.9p1-3ubuntu0.10)
Upgrade: netplan.io:amd64 (0.106.1-7ubuntu0.22.04.2, 0.106.1-7ubuntu0.22.04.4)
Upgrade: gh:amd64 (2.51.0, 2.52.0)
Upgrade: ubuntu-advantage-tools:amd64 (32.3~22.04, 32.3.1~22.04)
Upgrade: libnetplan0:amd64 (0.106.1-7ubuntu0.22.04.2, 0.106.1-7ubuntu0.22.04.4)
Upgrade: pgadmin4-server:amd64 (8.8, 8.9)
Upgrade: openssl:amd64 (3.0.2-0ubuntu1.15, 3.0.2-0ubuntu1.16)
Upgrade: linux-libc-dev:amd64 (5.15.0-112.122, 5.15.0-113.123)
Upgrade: ubuntu-pro-client:amd64 (32.3~22.04, 32.3.1~22.04)
End-Date: 2024-07-03  02:07:53
noesterle commented 1 month ago

I believe I am running into a similar issue. I can get all packages and build the project locally, however act is running into a MODULE_NOT_FOUND error with a module I can retrieve, have installed, and can use.

$ act --bug-report
act version:            0.2.65
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 12
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
    /var/run/docker.sock
Config files:           
    /home/nathan/.config/act/actrc:
        -P ubuntu-latest=catthehacker/ubuntu:act-latest
        -P ubuntu-22.04=catthehacker/ubuntu:act-22.04
        -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
        -P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
    Go version:            go1.21.12
    Module path:           github.com/nektos/act
    Main version:          (devel)
    Main path:             github.com/nektos/act
    Main checksum:         
    Build settings:
        -buildmode:           exe
        -compiler:            gc
        -ldflags:             -s -w -X main.version=0.2.65 -X main.commit=bda491e406db6c85865498ced18764bc00491a5e -X main.date=2024-08-01T02:22:32Z -X main.builtBy=goreleaser
        CGO_ENABLED:          0
        GOARCH:               amd64
        GOOS:                 linux
        GOAMD64:              v1
        vcs:                  git
        vcs.revision:         bda491e406db6c85865498ced18764bc00491a5e
        vcs.time:             2024-08-01T02:22:10Z
        vcs.modified:         false
Docker Engine:
    Engine version:        24.0.7
    Engine runtime:        runc
    Cgroup version:        2
    Cgroup driver:         systemd
    Storage driver:        overlay2
    Registry URI:          https://index.docker.io/v1/
    OS:                    Pop!_OS 22.04 LTS
    OS type:               linux
    OS version:            22.04
    OS arch:               x86_64
    OS kernel:             6.9.3-76060903-generic
    OS CPU:                12
    OS memory:             15702 MB
    Security options:
        name=apparmor
        name=seccomp,profile=builtin
        name=cgroupns
$ act
INFO[0000] Using docker host 'unix:///var/run/docker.sock', and daemon socket 'unix:///var/run/docker.sock' 
[main.yml/build] πŸš€  Start image=catthehacker/ubuntu:act-latest
[main.yml/build]   🐳  docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=true
[main.yml/build] using DockerAuthConfig authentication for docker pull
[main.yml/build]   🐳  docker create image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[main.yml/build]   🐳  docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[main.yml/build]   🐳  docker exec cmd=[node --no-warnings -e console.log(process.execPath)] user= workdir=
[main.yml/build]   ☁  git clone 'https://github.com/actions/setup-node' # ref=v4
[main.yml/build] ⭐ Run Main Checkout
[main.yml/build]   🐳  docker cp src=/home/nathan/code/git/oesterle-antora/. dst=/home/nathan/code/git/oesterle-antora
[main.yml/build]   βœ…  Success - Main Checkout
[main.yml/build] ⭐ Run Main Node
[main.yml/build]   🐳  docker cp src=/home/nathan/.cache/act/actions-setup-node@v4/ dst=/var/run/act/actions/actions-setup-node@v4/
[main.yml/build]   🐳  docker exec cmd=[/opt/acttoolcache/node/18.20.4/x64/bin/node /var/run/act/actions/actions-setup-node@v4/dist/setup/index.js] user= workdir=
[main.yml/build]   πŸ’¬  ::debug::isExplicit: 
[main.yml/build]   πŸ’¬  ::debug::explicit? false
[main.yml/build]   πŸ’¬  ::debug::isExplicit: 20.17.0
[main.yml/build]   πŸ’¬  ::debug::explicit? true
[main.yml/build]   πŸ’¬  ::debug::evaluating 1 versions
[main.yml/build]   πŸ’¬  ::debug::matched: 20.17.0
[main.yml/build]   πŸ’¬  ::debug::checking cache: /opt/hostedtoolcache/node/20.17.0/x64
[main.yml/build]   πŸ’¬  ::debug::Found tool in cache node 20.17.0 x64
| Found in cache @ /opt/hostedtoolcache/node/20.17.0/x64
[main.yml/build]   ❓  ::group::Environment details
| node: v20.17.0
| npm: 10.8.2
| yarn: 
[main.yml/build]   ❓  ::endgroup::
[main.yml/build]   ❓ add-matcher /run/act/actions/actions-setup-node@v4/.github/tsc.json
[main.yml/build]   ❓ add-matcher /run/act/actions/actions-setup-node@v4/.github/eslint-stylish.json
[main.yml/build]   ❓ add-matcher /run/act/actions/actions-setup-node@v4/.github/eslint-compact.json
[main.yml/build]   βœ…  Success - Main Node
[main.yml/build]   βš™  ::set-output:: node-version=v20.17.0
[main.yml/build]   βš™  ::add-path:: /opt/hostedtoolcache/node/20.17.0/x64/bin
[main.yml/build] ⭐ Run Main Build
[main.yml/build]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/2] user= workdir=
| 
| up to date, audited 149 packages in 570ms
| 
| 14 packages are looking for funding
|   run `npm fund` for details
| 
| found 0 vulnerabilities
| node:internal/modules/cjs/loader:641
|       throw e;
|       ^
| 
| Error: Cannot find module '/home/nathan/code/git/oesterle-antora/node_modules/yargs-parser/build/index.cjs'
|     at createEsmNotFoundErr (node:internal/modules/cjs/loader:1262:15)
|     at finalizeEsmResolution (node:internal/modules/cjs/loader:1250:15)
|     at resolveExports (node:internal/modules/cjs/loader:634:14)
|     at Module._findPath (node:internal/modules/cjs/loader:724:31)
|     at Module._resolveFilename (node:internal/modules/cjs/loader:1211:27)
|     at Module._load (node:internal/modules/cjs/loader:1051:27)
|     at Module.require (node:internal/modules/cjs/loader:1311:19)
|     at require (node:internal/modules/helpers:179:18)
|     at Object.<anonymous> (/home/nathan/code/git/oesterle-antora/node_modules/convict/src/main.js:9:19)
|     at Module._compile (node:internal/modules/cjs/loader:1469:14) {
|   code: 'MODULE_NOT_FOUND',
|   path: '/home/nathan/code/git/oesterle-antora/node_modules/yargs-parser/package.json'
| }
| 
| Node.js v20.17.0
[main.yml/build]   ❌  Failure - Main Build
[main.yml/build] exitcode '1': failure
[main.yml/build] 🏁  Job failed
Error: Job 'build' failed
$ npm ls yargs-parser
oesterle-antora@ /media/nathan/93ea1021-a910-42e9-a09d-34ac8c8e1a77/code/git/oesterle-antora
└─┬ @antora/cli@3.1.9
  └─┬ @antora/playbook-builder@3.1.9
    └─┬ convict@6.2.4
      └── yargs-parser@20.2.9

package.json

{
  "devDependencies": {
    "@antora/cli": "3.1.9",
    "@antora/site-generator": "3.1.9"
  },
  "dependencies": {
    "asciidoctor-plantuml": "^1.5.0"
  }
}

Workflow YAML

# This workflow will deploy the static website to the remote server.

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Node
        uses: actions/setup-node@v4
        with:
          node-version: 20
      - name: Build
        run: |
          npm install
          npx antora generate antora-playbook.yml --stacktrace
      - name: Test rsync restriction
        shell: bash
        run: |
          mkdir -p ~/.ssh/
          echo "${{secrets.DEPLOY_SSH_KEY}}" > ~/.ssh/private.key
          echo "Created Private Key File"
          sudo chmod 600 ~/.ssh/private.key
          echo "${{secrets.DEPLOY_KNOWN_HOST}}" > ~/.ssh/known_hosts
          echo "Added known hosts"

          CODE=1
          ssh -q -i ~/.ssh/private.key ${{secrets.DEPLOY_USER}}@${{secrets.HOST}}
          SUCCESS=$?
          echo "Success: $SUCCESS"
          if [[ $SUCCESS != 0 ]]; then
            echo "Task failed successfully"
            CODE=0
          fi
          echo $CODE
          exit $CODE
      - name: Deploy
        uses: up9cloud/action-rsync@v1.4
        env:
          HOST: ${{secrets.HOST}}
          USER: ${{secrets.DEPLOY_USER}}
          KEY: ${{secrets.DEPLOY_SSH_KEY}}
          TARGET: .
          MODE: push
          SOURCE: build/site/
smashedr commented 1 month ago

@noesterle Make sure you don't have your node_modules in your .gitignore or use --use-gitignore=false

I added more information about this here: https://github.com/smashedr/js-test-action

noesterle commented 1 month ago

Using --use-gitignore=false worked for me, thank you!

I didn't have node_modules in my .gitignore, the only thing that was in there was where the build output is put. If act respecting the .gitignore meant that directory couldn't be created/seen, that must have triggered the same message.