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

postinstall of vue-demi on Windows #7562

Open
2 of 4 tasks
shellscape opened this issue Jan 23, 2024 · 1 comment
Open
2 of 4 tasks

postinstall of vue-demi on Windows #7562

shellscape opened this issue Jan 23, 2024 · 1 comment

Comments

@shellscape
Copy link
Contributor

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

corepack prepare pnpm@latest --activate

Which area(s) of pnpm are affected? (leave empty if unsure)

CLI

Link to the code that reproduces this issue or a replay of the bug

see below

Reproduction steps

vueuse/vue-demi#248 outlines the original issue. I was hoping it was something that might get fixed on Vue's end by using a different method, but it got no traction. This appears like it could be a bug with pnpm, but wanted to run this by the team to see.

The .npmrc with configuration is located here: https://github.com/shellscape/jsx-email/blob/main/.npmrc

Describe the Bug

Here's an additional failing workflow run: https://github.com/shellscape/jsx-email/actions/runs/7631321526/job/20789011768#step:10:22

I suspect that this is a cross-platform path bug, but haven't been able to verify yet. The weird thing is that there isn't any error message, just bails and says that it failed.

Expected Behavior

If it was a path issue, I thought I'd see an error describing the error. Something like this:

node:internal/modules/cjs/loader:1137
  throw err;
  ^

Error: Cannot find module '/.../asdasd.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1134:15)
    at Module._load (node:internal/modules/cjs/loader:975: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.19.0

So this could possibly be an issue with output/logging rather than failing to run a script in postinstall?

Which Node.js version are you using?

18

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

If your OS is a Linux based, which one it is? (Include the version if relevant)

n/a

@shellscape
Copy link
Contributor Author

Some more on what I've learned since opening this.

Since I have this in the workflow:

      - name: Enable Corepack
        id: pnpm-setup
        run: |
          corepack enable
          corepack prepare pnpm@latest --activate
          pnpm config set script-shell "/usr/bin/bash"
          echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"

and more notabably, pnpm config set script-shell "/usr/bin/bash", this would have always failed. After removing that, the postinstall still fails, but that's one less possibility for failure.

I then tried setting the shell in the workflow to bash, which on Windows will use the Git Bash shell

      - name: pnpm install
        run: pnpm install --frozen-lockfile
        shell: bash

But that also yielded a failure. Consulted the pnpm docs on set-shell and came up with this:

      - name: pnpm install
        run: |
          pnpm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
          pnpm install --frozen-lockfile
        shell: bash

Which did ultimately complete a successful install. So while I don't think this is a bug in pnpm any longer, there's a few takeaways questions there that might help to improve pnpm:

  • should pnpm validate that the path used with set-shell exists? In the example above, on Windows it did not
  • should pnpm have different defaults on Windows, given the nature of the npm ecosystem? e.g. looking for and choosing git-bash by default for npm scripts?

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

No branches or pull requests

1 participant