Act: MODULE_NOT_FOUND on Windows 10 with Linux Containers

Created on 4 Aug 2020  ยท  10Comments  ยท  Source: nektos/act

Copied from here

I am developing on a Windows environment and building in a Linux container for docker, this is what I receive when running act.

act has been installed via Chocolatey, and also directly from the latest release.

[34m[CI Build - Master/build] [0mโญ Run Setup .NET Core
[34m[CI Build - Master/build] [0m โ˜ git clone 'https://github.com/actions/setup-dotnet' # ref=v1
[34m[CI Build - Master/build] [0m ๐Ÿณ docker cp src=act/actions-setup-dotnet@v1 dst=/actions
[34m|[0m internal/modules/cjs/loader.js:628
[34m|[0m throw err;
[34m|[0m ^
[34m|[0m
[34m|[0m Error: Cannot find module '/github/workspace/[email protected]'
[34m|[0m [90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:625:15)[39m
[34m|[0m [90m at Function.Module._load (internal/modules/cjs/loader.js:527:27)[39m
[34m|[0m [90m at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)[39m
[34m|[0m [90m at internal/main/run_main_module.js:17:11[39m {
[34m|[0m code: [32m'MODULE_NOT_FOUND'[39m,
[34m|[0m requireStack: []
[34m|[0m }
[34m[CI Build - Master/build] [0m โŒ Failure - Setup .NET Core
Error: exit with FAILURE: 1

Most helpful comment

The workaround is using Ubuntu 20+WSL2 on Win 10, installing Docker, enabling WSL2 for docker, enabling WSL2 integration in docker to Ubuntu 20, and then using act from the Ubuntu environment.

All 10 comments

Same problem here.

C:\Users\Artem Russakovskii\workspace\app>act
โ†[34m[Android CI/Lint and Build] โ†[0m๐Ÿš€  Start image=node:12.6-buster-slim
โ†[34m[Android CI/Lint and Build] โ†[0m  ๐Ÿณ  docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
โ†[34m[Android CI/Lint and Build] โ†[0m  ๐Ÿณ  docker cp src=C:\Users\Artem Russakovskii\workspace\app/. dst=\github\workspace
โ†[34m[Android CI/Lint and Build] โ†[0mโญ  Run actions/checkout@v1
โ†[34m[Android CI/Lint and Build] โ†[0m  โœ…  Success - actions/checkout@v1
โ†[34m[Android CI/Lint and Build] โ†[0mโญ  Run Setup JDK 1.8
โ†[34m[Android CI/Lint and Build] โ†[0m  โ˜  git clone 'https://github.com/actions/setup-java' # ref=v1
โ†[34m[Android CI/Lint and Build] โ†[0m  ๐Ÿณ  docker cp src=act/actions-setup-java@v1 dst=/actions\
โ†[34m|โ†[0m internal/modules/cjs/loader.js:628
โ†[34m|โ†[0m     throw err;
โ†[34m|โ†[0m     ^
โ†[34m|โ†[0m
โ†[34m|โ†[0m Error: Cannot find module '/github/workspace/\actions\actions-setup-java@v1\dist\setup\index.js'
โ†[34m|โ†[0m โ†[90m    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:625:15)โ†[39m
โ†[34m|โ†[0m โ†[90m    at Function.Module._load (internal/modules/cjs/loader.js:527:27)โ†[39m
โ†[34m|โ†[0m โ†[90m    at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)โ†[39m
โ†[34m|โ†[0m โ†[90m    at internal/main/run_main_module.js:17:11โ†[39m {
โ†[34m|โ†[0m   code: โ†[32m'MODULE_NOT_FOUND'โ†[39m,
โ†[34m|โ†[0m   requireStack: []
โ†[34m|โ†[0m }
โ†[34m[Android CI/Lint and Build] โ†[0m  โŒ  Failure - Setup JDK 1.8
Error: exit with `FAILURE`: 1

Ditto:

[BUILD Package/Build BCDC-SMK container image          ] ๏ฟฝ  Start image=node:12.6-buster-slim
[BUILD Package/Build BCDC-SMK container image          ]   ๏ฟฝ  docker run image=node:12.6-buster-slim entrypoint=["/usr/b in/tail" "-f" "/dev/null"] cmd=[]
[BUILD Package/Build BCDC-SMK container image          ] โญ  Run actions/checkout@v2
[BUILD Package/Build BCDC-SMK container image          ]   โ˜  git clone 'https://github.com/actions/checkout' # ref=v2
[BUILD Package/Build BCDC-SMK container image          ]   ๏ฟฝ  docker cp src=act/actions-checkout@v2 dst=/actions\
| internal/modules/cjs/loader.js:628
|     throw err;
|     ^
|
| Error: Cannot find module '/github/workspace/\actions\actions-checkout@v2\dist\index.js'
|     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:625:15)
|     at Function.Module._load (internal/modules/cjs/loader.js:527:27)
|     at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
|     at internal/main/run_main_module.js:17:11 {
|   code: 'MODULE_NOT_FOUND',
|   requireStack: []
| }
[BUILD Package/Build BCDC-SMK container image          ]   โŒ  Failure - actions/checkout@v2
Error: exit with `FAILURE`: 1

This issue went away for me when I commented out the ref property in the checkout step:

   ...
    runs-on: ubuntu-18.04
    steps:
    - uses: actions/checkout@v2
      id: checkout
      with:
        # ----- comment out ref seems to resolve this issue for me
        #ref: v2
        fetch-depth: 0

Does not resolve for me:

โฏ act
[Build and Deploy/Build and Deploy] ๐Ÿš€ Start image=node:12.6-buster-slim
[Build and Deploy/Build and Deploy] ๐Ÿณ docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Build and Deploy/Build and Deploy] ๐Ÿณ docker cp src=C:UserstimheuerDocumentsGitHubaspnet-core-sample-deploy/. dst=githubworkspace
[Build and Deploy/Build and Deploy] โญ Run actions/checkout@v2
[Build and Deploy/Build and Deploy] โœ… Success - actions/checkout@v2
[Build and Deploy/Build and Deploy] โญ Run Setup .NET Core SDK ${{ env.NETCORE_VERSION }}
[Build and Deploy/Build and Deploy] โ˜ git clone 'https://github.com/actions/setup-dotnet' # ref=v1
[Build and Deploy/Build and Deploy] ๐Ÿณ docker cp src=C:Userstimheuer.cacheact/actions-setup-dotnet@v1 dst=/actions
| internal/modules/cjs/loader.js:628
| throw err;
| ^
|
| Error: Cannot find module '/github/workspace/[email protected]'
| at Function.Module._resolveFilename (internal/modules/cjs/loader.js:625:15)
| at Function.Module._load (internal/modules/cjs/loader.js:527:27)
| at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
| at internal/main/run_main_module.js:17:11 {
| code: 'MODULE_NOT_FOUND',
| requireStack: []
| }
[Build and Deploy/Build and Deploy] โŒ Failure - Setup .NET Core SDK ${{ env.NETCORE_VERSION }}
Error: exit with FAILURE: 1

I'm trying to launch the Azure Login sample, with this definition:

on: [push]

name: AzureLoginSample

jobs:

  build-and-deploy:
    runs-on: ubuntu-latest
    steps:

    - uses: azure/[email protected]
      with:
        creds: ${{ secrets.AZURE_CREDENTIALS }}

    - run: |
        az webapp list --query "[?state=='Running']"

But I get the MODULE_NOT_FOUND error:

[AzureLoginSample/build-and-deploy] ๐Ÿš€  Start image=node:12.6-buster-slim
[AzureLoginSample/build-and-deploy]   ๐Ÿณ  docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[AzureLoginSample/build-and-deploy] โญ  Run azure/[email protected]
[AzureLoginSample/build-and-deploy]   โ˜  git clone 'https://github.com/azure/login' # ref=v1.1
[AzureLoginSample/build-and-deploy]   ๐Ÿณ  docker cp src=act/[email protected] dst=/actions\
| internal/modules/cjs/loader.js:628
|     throw err;
|     ^
|
| Error: Cannot find module '/github/workspace/\actions\[email protected]\lib\main.js'
|     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:625:15)
|     at Function.Module._load (internal/modules/cjs/loader.js:527:27)
|     at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
|     at internal/main/run_main_module.js:17:11 {
|   code: 'MODULE_NOT_FOUND',
|   requireStack: []
| }
[AzureLoginSample/build-and-deploy]   โŒ  Failure - azure/[email protected]
Error: exit with `FAILURE`: 1

I'm using Windows 10, and the WSL is version 2:

```
wsl -l -v
NAME STATE VERSION

  • Ubuntu-20.04 Running 2
    docker-desktop-data Running 2
    docker-desktop Running 2
    ```

It might be a path related issue.
docker cp src=act/arbitrary-linux-image@master dst=/actions\
Here, the dst will be run in a Linux environment. Linux might confuse the \ at the end.

That's what I think as well, because when I run act in the same machine
but from Linux, it works.

This line doesn't look good neither: /github/workspace/\actions\[email protected]\lib\main.js

Agreed, need to convert posix paths

Hey guys, will this be fixed soon, or is there any work around to this in win 10. Stuck on this for a while : (

The workaround is using Ubuntu 20+WSL2 on Win 10, installing Docker, enabling WSL2 for docker, enabling WSL2 integration in docker to Ubuntu 20, and then using act from the Ubuntu environment.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

magiskboy picture magiskboy  ยท  3Comments

Sygmei picture Sygmei  ยท  3Comments

kochetkovIT picture kochetkovIT  ยท  4Comments

kenorb picture kenorb  ยท  5Comments

mheap picture mheap  ยท  5Comments