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

Error: spawn npm ENOENT #193

Closed
Rutger-Knijnenburg opened this issue Oct 27, 2022 · 8 comments
Closed

Error: spawn npm ENOENT #193

Rutger-Knijnenburg opened this issue Oct 27, 2022 · 8 comments

Comments

@Rutger-Knijnenburg
Copy link

I'm using this action to version bump after building the project and installing NPM packages.

However on the version bump action I get this error. I don't understand why, the runner is using node V 16.13.1.

✖  fatal     Error: spawn npm ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
✖  fatal     Failed to bump version

My folder structure:

Root
---- ProjectA [folder]
------- dist [folder
------- readme.md
------- package.json
------- package-lock.json
---- ProjectB [folder
.gitignore
.readme

Action (partly):

    - name: "Version Bump"
      uses: "phips28/gh-action-bump-version@master"
      with:
        tag-prefix: 'V'
        minor-wording:  'minor,Minor'
        major-wording: 'major,Major'
        rc-wording: 'release, RELEASE,Release, Alpha,alpha'
        commit-message: 'CI: bumps version to {{version}} [skip ci]'
      env:
        PACKAGEJSON_DIR:  'ProjectA'
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@phips28
Copy link
Owner

phips28 commented Oct 27, 2022

Do you see more logs before the fatal? to maybe point to the right code line it crashed.

@EvgenySerebrenny
Copy link

EvgenySerebrenny commented Oct 27, 2022

Seeing the same problem with similar setup. No relevant logs before fatal crash

Run phips28/gh-action-bump-version@v9.0.31
  with:
    commit-message: version bump to {{version}} [skip ci]
    bump-policy: ignore
    target-branch: master
    minor-wording: feat,minor
    major-wording: BREAKING CHANGE,major
    rc-wording: pre-alpha,pre-beta,pre-rc
    skip-tag: false
    skip-commit: false
    skip-push: false
    default: patch
    preid: rc
    push: true
  env:
    GITHUB_TOKEN: ***
    PACKAGEJSON_DIR: services/proton
Couldn't find any commits in this event, incrementing patch version...
tagPrefix: 
commit messages: []
Ignoring any version bumps in commits...
config words: {
  majorWords: [ 'BREAKING CHANGE', 'major' ],
  minorWords: [ 'feat', 'minor' ],
  patchWords: null,
  preReleaseWords: [ 'pre-alpha', 'pre-beta', 'pre-rc' ]
}
version action after first waterfall: patch
version action after final decision: patch
currentBranch: master
✖  fatal     Error: spawn npm ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
    at onErrorNT (internal/child_process.js:470:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
✖  fatal     Failed to bump version

phips28 added a commit that referenced this issue Oct 27, 2022
@phips28
Copy link
Owner

phips28 commented Oct 27, 2022

Can you try the latest version: https://github.com/phips28/gh-action-bump-version/releases/tag/v9.0.38
I added more logs what command fails.

It has something to do with the workspace (but I am not using this actively in my own setups)

@Rutger-Knijnenburg
Copy link
Author

Rutger-Knijnenburg commented Oct 28, 2022

Logging while using latest version (v9.0.38):

I am using:
defaults:
run:
working-directory: ./Projects

On the job itself. Is that what you mean by workspace?

Run phips[2]8/gh-action-bump-version@v9.0.[3]8
  with:
    tag-prefix: V
    minor-wording: minor,Minor
    major-wording: major,Major
    rc-wording: release, RELEASE,Release, Alpha,alpha
    commit-message: CI: bumps version to {{version}} [skip ci]
    skip-tag: false
    skip-commit: false
    skip-push: false
    default: patch
    preid: rc
    bump-policy: all
    push: true
  env:
    NODE_VERSION: 16.13.1
    PACKAGEJSON_DIR: ProjectA
    GITHUB_TOKEN: ***
process.env.GITHUB_WORKSPACE D:\a\DU\DU/Projects
tagPrefix: V
commit messages: [ 'Update deploy CMS DEV.yml\nundefined' ]
config words: {
  majorWords: [ 'major', 'Major' ],
  minorWords: [ 'minor', 'Minor' ],
  patchWords: null,
  preReleaseWords: [ 'release', ' RELEASE', 'Release', ' Alpha', 'alpha' ]
}
version action after first waterfall: patch
version action after final decision: patch
runInWorkspace | command: git args: [ 'config', 'user.name', '"Automated Version Bump"' ]
runInWorkspace | command: git args: [
  'config',
  'user.email',
  '"gh-action-bump-version@users.noreply.github.com"'
]
currentBranch: develop
runInWorkspace | command: npm args: [
  'version',
  '--allow-same-version=true',
  '--git-tag-version=false',
  '0.0.1'
]
✖  fatal     Error: spawn npm ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:[4]
✖  fatal     Failed to bump version

@phips28
Copy link
Owner

phips28 commented Oct 28, 2022

Are you running on a windows machine?
Because this has backslashes: process.env.GITHUB_WORKSPACE D:\a\DU\DU/Projects
Can you share your runs-on:
https://github.com/phips28/gh-action-bump-version/blob/master/.github/workflows/push.yml#L11

@Rutger-Knijnenburg
Copy link
Author

Correct:

runs-on: windows-latest

@phips28
Copy link
Owner

phips28 commented Oct 28, 2022

Ok then this action is not working on windows as it seems 😄
never tested on windows, and will never use windows for dev purposes 😉

But you can make a PR to support windows:

  • make sure backslash is used everywhere
  • make sure npm commands are the same on windows as on linux systems
  • check runInWorkspace() usage with spawn commands, if they work on windows as expected

@Rutger-Knijnenburg
Copy link
Author

Ah I see :P Can confirm this all works on ubuntu-latest indeed.
Will try to get this working on windows when I have the time!

Thanks for your assistance.

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

No branches or pull requests

3 participants