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

Install npm on Windows #525

Closed
2 tasks
wenkokke opened this issue Jun 21, 2022 · 6 comments
Closed
2 tasks

Install npm on Windows #525

wenkokke opened this issue Jun 21, 2022 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@wenkokke
Copy link

Description:
On a windows-latest instance, I'm getting an error saying npm and npm.exe are not found.

Action version:
actions/setup-node@v3

Platform:

  • Windows

Runner type:

  • Hosted

Tools version:

Using node-version with version 16.

Repro steps:
A description with steps to reproduce the issue. If you have a public example or repo to share, please provide the link.
See .github/workflows/ci.yml, and, for example, these runs:

Expected behavior:
I expect npm.exe and npx.exe to be on the path.

Actual behavior:
For example:

npx.exe: createProcess: does not exist (No such file or directory)
@wenkokke wenkokke added bug Something isn't working needs triage labels Jun 21, 2022
@dmitry-shibanov
Copy link
Contributor

Hello @wenkokke. Thank you for your report. I've tried to reproduce the issue with pure yml file but it works as expected. Npm and npx are available.

    steps:
    - name: Checkout repository
      uses: actions/checkout@v3
    - name: Setup Node
      uses: actions/setup-node@v3
      with:
        node-version: 16
    - run: |
        npm --version
        npx --version

@dmitry-shibanov
Copy link
Contributor

Hello @wenkokke. For now I'm going to close the issue because npm and npx are installed and added to PATH. If you have any additional information feel free to ping us.

@pinheadmz
Copy link

I think I have a related issue in this project: https://github.com/handshake-org/hnsd/actions/runs/3268205243/jobs/5374328925

> Run actions/setup-node@v1
  with:
    always-auth: false
    node-version: 10.x
  env:
    MSYSTEM: MINGW64
C:\hostedtoolcache\windows\node\10.24.1\x64\node.exe --version
v10.24.1
C:\Windows\system32\cmd.exe /D /S /C "C:\hostedtoolcache\windows\node\10.24.1\x64\npm.cmd --version"
6.14.12
0s

> Run npm install
  npm install
  npm run test
  shell: D:\a\_temp\setup-msys2\msys2.CMD {0}
  env:
    MSYSTEM: MINGW64
D:\a\_temp\a35b51d9-b447-4b9b-a38c-0672498f7045: line 1: npm: command not found
Error: Process completed with exit code 127.

deining pushed a commit to deining/setup-node that referenced this issue Nov 9, 2023
…ions#525)

Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 8.8.0 to 8.9.0.
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](prettier/eslint-config-prettier@v8.8.0...v8.9.0)

---
updated-dependencies:
- dependency-name: eslint-config-prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@trusktr
Copy link

trusktr commented Apr 28, 2024

I'm having this issue. Here's the failed build:

https://github.com/lume/element/actions/runs/8865892376/job/24342663670?pr=13

with this error

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

Error: Cannot find module 'C:\npm\prefix\node_modules\npm\bin\npm-cli.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1202:15)
    at Module._load (node:internal/modules/cjs/loader:102[7](https://github.com/lume/element/actions/runs/8865892376/job/24342663670?pr=13#step:4:8):27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:1[8](https://github.com/lume/element/actions/runs/8865892376/job/24342663670?pr=13#step:4:9)7:14)
    at node:internal/main/run_main_module:28:4[9](https://github.com/lume/element/actions/runs/8865892376/job/24342663670?pr=13#step:4:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Here's my yml file:

name: Build and Test

on: [push]

jobs:
    build:
        runs-on: ${{ matrix.operating-system }}

        strategy:
            matrix:
                operating-system: [ubuntu-latest, macos-latest, windows-latest]

        steps:
            - uses: actions/checkout@v1
            - name: Use Node.js latest
              uses: actions/setup-node@v3
              with:
                  node-version: latest
            - name: install
              run: |
                  npm i
                  npx playwright install
            - name: check formatting
              run: |
                  npm run prettier:check
            - name: build
              run: |
                  npm run clean
                  npm run build
            - name: test
              run: |
                  npm test
            - name: check repo is clean
              # skip this check in windows for now, as the build outputs may get slightly modified in Windows, which we want to fix.
              if: runner.os != 'Windows'
              run: |
                  git add . && git diff --quiet && git diff --cached --quiet
              env:
                  CI: true

@trusktr
Copy link

trusktr commented Apr 28, 2024

Updated to actions/setup-node@v4, same issue.

@trusktr
Copy link

trusktr commented Apr 28, 2024

People here have the same exact issue:

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

4 participants