catthehacker / docker_images

Docker images
MIT License
212 stars 75 forks source link

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

Closed smashedr closed 2 months ago

smashedr commented 2 months ago

All my local actions started throwing this error:

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:

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

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

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 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?

Full error for reference:

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
smashedr commented 2 months ago

I just realized I opened this in the wrong repository when I could not find it, I will close this out and open it in the right place.