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

Seemingly invalid path separator on Windows using actions/setup-node #145

Closed
Swiftwork opened this issue Mar 11, 2020 · 18 comments
Closed
Labels
area/action Relating to running an action kind/bug Something isn't working meta/workaround A workaround has been identified. stale
Projects

Comments

@Swiftwork
Copy link

Running command

act -P ubuntu-latest=nektos/act-environments-ubuntu:18.04

on Microsoft Windows 10 Pro Build 10.0.18363 using release v0.2.6

- name: Set up Node.js version 13.x
  uses: actions/setup-node@v1
  with:
    node-version: 13.x

results in

[Continuous Delivery/Node 13.x]   �🐳  docker cp src=act/actions-setup-node@v1 dst=/actions\
| internal/modules/cjs/loader.js:985
|   throw err;
|   ^
|
| Error: Cannot find module '/github/workspace/\actions\actions-setup-node@v1\dist\index.js'
|     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
|     at Function.Module._load (internal/modules/cjs/loader.js:864:27)
|     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
|     at internal/main/run_main_module.js:18:47 {
|   code: 'MODULE_NOT_FOUND',
|   requireStack: []
| }
[Continuous Delivery/Node 13.x]   ❌  Failure - Set up Node.js version 13.x
Error: exit with `FAILURE`: 1

This seems to be an issue with Windows and POSIX not using the same path separators. However I don't know where this issue lies, if its with nektos/act or actions/setup-node. If you can't reproduce the issue it occurs currently with trutoo/event-bus. It does however work in in my WSL.

@cplee cplee added area/action Relating to running an action kind/bug Something isn't working labels Mar 11, 2020
@cplee
Copy link
Contributor

cplee commented Mar 11, 2020

This looks like a bug with act. In an effort to support windows, i overdid the use of filepath.Join() and filepath.Separator. These create paths that are windows specific and are then fed in to the linux container 🤦‍♂️

All the places that use those need to be reviewed to determine if the path is used on the host or within the container. The ones in the container should all use / explicitly.

@aslafy-z
Copy link

This behavior has to be specific to Linux containers. In windows containers, path separator has to match the windows path separator (\). I've seen that windows runners aren't supported in act from now so it may not be a priority but it guess it can be implemented in a adaptable way for the future.

@ArwynFr
Copy link

ArwynFr commented Apr 4, 2020

Workspace volume mount is impacted as well.
Instead of creating a hierarchic directory, all files are flattened in the same directory :

[integration/build]   �🐳  docker run image=arwynfr/armake2:alpine entrypoint=["ls"] cmd=["-l" "/github/workspace/"]
| total 1932
| -rw-rw-rw-    1 root     root          1082 Mar 23 22:12 LICENSE
| drwxr-xr-x    2 root     root          4096 Apr  4 02:50 \github\workspace
| -rw-rw-rw-    1 root     root          1403 Mar 23 22:49 addons\gsri_opex\CfgNotifications.hpp
| -rw-rw-rw-    1 root     root          8320 Apr  4 02:44 addons\gsri_opex\Stringtable.xml
| -rw-rw-rw-    1 root     root          2610 Apr  4 02:44 addons\gsri_opex\config.cpp
| -rw-rw-rw-    1 root     root           633 Mar 23 22:12 addons\gsri_opex\functions\bays\fn_bayReplace.sqf
...
`

@github-actions
Copy link
Contributor

github-actions bot commented Jun 4, 2020

Issue is stale and will be closed in 7 days unless there is new activity

@github-actions github-actions bot added the stale label Jun 4, 2020
@cplee cplee removed the stale label Jun 4, 2020
@Pomax
Copy link

Pomax commented Jun 7, 2020

I'm running into this today, Windows 10 x64 with Latest Docker, github action running against ubuntu-latest, act version 0.2.9:

  node:
    name: Installing Node 12 and required project packages
    runs-on: ubuntu-latest
    shell: bash
    steps:
      - uses: actions/checkout@master
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v1
        with:
          node-version: '12'
      - name: Installing dependencies
        run: npm install

Result:

[CI-CD/Installing Node 12 and required project packages    ]   �🐳  docker cp src=act/actions-setup-node@v1 dst=/actions\
| internal/modules/cjs/loader.js:628
|     throw err;
|     ^
|
| Error: Cannot find module '/github/workspace/\actions\actions-setup-node@v1\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: []
| }
[CI-CD/Installing Node 12 and required project packages    ]   ❌  Failure - actions/setup-node@v1
Error: exit with `FAILURE`: 1

@Pomax
Copy link

Pomax commented Jun 7, 2020

So one thing to bear in mind: windows has had support for the / path delimiter since literally before it was Windows; the only consideration is that you need to use double-quote paths with special characters. So sanitizing by using \/ is actually a really bad idea and will more often than not outright break things.

@fenilli
Copy link

fenilli commented Jun 7, 2020

So one thing to bear in mind: windows has had support for the / path delimiter since literally before it was Windows; the only consideration is that you need to use double-quote paths with special characters. So sanitizing by using \/ is actually a really bad idea and will more often than not outright break things.

Did you find a workaround? having the same problem right now.

@Pomax
Copy link

Pomax commented Jun 8, 2020

no I literally gave up after trying to get act to actually work properly for several hours today. I'll just spent GA minutes on iterating on a script in a live repo instead. Good idea for a tool, but just nowhere near where it needs to be in order to make life easier, rather than harder.

@fenilli
Copy link

fenilli commented Jun 8, 2020

no I literally gave up after trying to get act to actually work properly for several hours today. I'll just spent GA minutes on iterating on a script in a live repo instead. Good idea for a tool, but just nowhere near where it needs to be in order to make life easier, rather than harder.

I will try running on wsl and see how it works, but this bug is really an annoying one.

@fenilli
Copy link

fenilli commented Jun 9, 2020

As a workaround to this bug, you can use WSL2.

By installing windows 10 update 2004, and enabling wsl, updating the kernel to wsl 2, installing docker and enabling to use wsl2, then running the command act will work properly without invalid path separator.

@cplee cplee added the meta/workaround A workaround has been identified. label Jun 9, 2020
@DUG-nick
Copy link

Hi,
I would like to point out, that I could not replicate the workaround.
I am running Docker Version 2.3.0.3 (45519) with WSL2 on a freshly updated Windows 10 Pro.

Sadly, I have nothing to contribute. Just issues reproducing the workaround :(

@Splode
Copy link

Splode commented Jul 25, 2020

I'm receiving this error as well running Windows 10 with Docker and WSL2. I'm trying to run act with the github-actions-demo project.

@satyaki1
Copy link

satyaki1 commented Jul 29, 2020

Windows users, please make sure you're on "Linux Container".
To check, right-click on Docker Desktop from task bar and choose "Switch to Linux Container". This will solve the problem.

This works, irrespective of your windows version compatible with WSL2 or not.

@Splode
Copy link

Splode commented Jul 30, 2020

Windows users, please make sure you're on "Linux Container".
To check, right-click on Docker Desktop from task bar and choose "Switch to Linux Container". This will solve the problem.

Docker Desktop is running Linux containers in my case.

@Komposten
Copy link

Ran act successfully using WSL 1 today, with Docker for Windows set to Linux containers.

Running it straight on Windows (using CMD, Git Bash, or similar) does not work. (In my case it was the cedx/setup-dart action rather than actions/setup-node.)

@satyaki1
Copy link

Windows users, please make sure you're on "Linux Container".
To check, right-click on Docker Desktop from task bar and choose "Switch to Linux Container". This will solve the problem.

Docker Desktop is running Linux containers in my case.

You may try adding to your environment path COMPOSE_CONVERT_WINDOWS_PATHS 0 or 1 as per your need, and run again. FYI

@terabytesoftw
Copy link

any solution

@github-actions
Copy link
Contributor

Issue is stale and will be closed in 7 days unless there is new activity

@github-actions github-actions bot added the stale label Oct 19, 2020
Roadmap automation moved this from To do to Done Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/action Relating to running an action kind/bug Something isn't working meta/workaround A workaround has been identified. stale
Projects
Roadmap
  
Done
Development

No branches or pull requests