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

Apheleia-npx fails on windows #311

Open
JordanAnthonyKing opened this issue Jul 23, 2024 · 1 comment
Open

Apheleia-npx fails on windows #311

JordanAnthonyKing opened this issue Jul 23, 2024 · 1 comment

Comments

@JordanAnthonyKing
Copy link

Firstly, bash needs to be on the path for aphelia to not fail silently, although this is somewhat normal it'd be nice to know it's a requirement.

After adding bash to the path I was hitting an error with the script trying to combine windows and posix style paths:

$ "bash" "c:/Users/jking/.config/emacs/.local/straight/build-30.0.50/apheleia/scripts/formatters/apheleia-npx" "prettier" "--stdin-filepath" "c:/Users/jking/source/XSight/XClient/apps/location/src/app/modules/locations/components/data-providers/data-provider-popup/basic-auth-data-provider/basic-auth-data-provider.component.ts" "--tab-width" "2"

C:\Users\jking\source\XSight\XClient\node_modules\.bin/../node/bin/node: line 1: This: command not found

Command failed with exit code 127.

I fixed it with the following hack for now:

    elif [[ -n ${npm_root} ]]; then
        # trying npm
        node_modules_paths=(\
            $(node -e 'console.log(require.resolve.paths("").map(path => path.replace(/\\/g, "/").join("\n"))'))
        for path in ${node_modules_paths[@]}; do
            echo path
            if [[ -x "${path}/.bin/$1" ]]; then
                exec "${path}/.bin/$1" "${@:2}"
            fi
        done
    fi
raxod502 added a commit that referenced this issue Sep 3, 2024
@raxod502
Copy link
Member

raxod502 commented Sep 3, 2024

I've pushed a commit that documents the dependencies explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants