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

Windows npm bin not on PATH #477

Closed
2 of 5 tasks
ospencer opened this issue Apr 27, 2022 · 2 comments
Closed
2 of 5 tasks

Windows npm bin not on PATH #477

ospencer opened this issue Apr 27, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@ospencer
Copy link

Description:
On Windows, it appears that the npm prefix C:\npm\prefix is on the PATH instead of the bin folder within the npm prefix, C:\npm\prefix\bin. This causes global packages to be unavailable when installed via npm install --global.

Action version:
3.1.1

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

Node 14, 16, and 18, included version of npm

Repro steps:

  1. Use actions/setup-node with any Node version
  2. Install a command line package with --global, like shx: npm install shx --global
  3. Run the command.

I added a step to this CI run to print out all of the paths on the PATH, and you see C:\npm\prefix instead of C:\npm\prefix\bin (it's the fourth step):
https://github.com/grain-lang/grain/runs/6200569895

Expected behavior:
The command should be available and $(npm config get prefix)\bin should be on the PATH.

Actual behavior:
The command is not found.

@ospencer ospencer added bug Something isn't working needs triage labels Apr 27, 2022
@dmitry-shibanov
Copy link
Contributor

Hello @ospencer. Thank you for your report. I've tried to reproduce the issue using the npm install shx -g command but it works as expected through npm. It looks like in your case you're using yarn to install global packages, that is why the output from the yarn global bin command should be added to the PATH.

@ospencer
Copy link
Author

Hey @dmitry-shibanov, I didn't think that was important because of yarn config set prefix $(npm config get prefix) (since that works on other OSes) but yep, the relevant documentation is here: https://docs.npmjs.com/cli/v7/configuring-npm/folders#executables

tl;dr yarn uses <prefix>\bin always but npm uses <prefix>/bin on Unix and just <prefix> on Windows.

Wanted to avoid having to alter the PATH just on Windows, but looks we've got to. 😅

I'll close this. Thanks for your help!

@dmitry-shibanov dmitry-shibanov self-assigned this Apr 29, 2022
deining pushed a commit to deining/setup-node that referenced this issue Nov 9, 2023
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.9.4 to 4.9.5.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](microsoft/TypeScript@v4.9.4...v4.9.5)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants