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

The entire package.json is used as the "node version" when using node-versions-file #864

Closed
2 of 5 tasks
NullVoxPopuli opened this issue Oct 4, 2023 · 5 comments
Closed
2 of 5 tasks
Assignees
Labels
bug Something isn't working

Comments

@NullVoxPopuli
Copy link
Contributor

NullVoxPopuli commented Oct 4, 2023

Description:

There is a message about not finding the node version in the manifest, so it says it'll fallback to downloading node, but it uses the entire package.json as the "node version", rather than an actual semver-style version

Run actions/setup-node@v3
  with:
    node-version-file: package.json
    always-auth: false
    check-latest: false
    token: ***
Resolved package.json as {}
Attempting to download {}...
Not found in manifest. Falling back to download directly from Node
Error: Unable to find Node version '{}' for platform linux and architecture x64.

Example: https://github.com/NullVoxPopuli/actions-testing/actions/runs/6410471015/job/17403838984

Action version:
v3

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:
defaults

Repro steps:

a job that does:

  aaa:
    name: 'actions/setup-node (with node-version-file: empty package.json)'
    runs-on: ubuntu-latest
    steps: 
      - uses: actions/checkout@v4
      # clear the package.json
      - run: 'echo "{}" > package.json'
      - uses: actions/setup-node@v3
        with:
          node-version-file: package.json
      - run: node --version

https://github.com/NullVoxPopuli/actions-testing/blob/main/.github/workflows/testing.yml#L29-L39

Another example, where I put a name entry in the package.json

  aaa:
    name: 'actions/setup-node (with node-version-file: empty package.json)'
    runs-on: ubuntu-latest
    steps: 
      - uses: actions/checkout@v4
      # clear the package.json
      - run: 'echo "{ \"name\": \"test\" }" > package.json'
      - uses: actions/setup-node@v3
        with:
          node-version-file: package.json
      - run: node --version

Results in:

Run actions/setup-node@v3
  with:
    node-version-file: package.json
    always-auth: false
    check-latest: false
    token: ***
Resolved package.json as { "name": "test" }
Attempting to download { "name": "test" }...
Not found in manifest. Falling back to download directly from Node
Error: Unable to find Node version '{ "name": "test" }' for platform linux and architecture x64.

https://github.com/NullVoxPopuli/actions-testing/actions/runs/6410629979/job/17404330263#step:4:11

Expected behavior:
ignore node-version-file, since it does not contain a node version, and the entire file itself (which is json) is not a valid version)

Actual behavior:
the entire json file is being used as the version.

@NullVoxPopuli
Copy link
Contributor Author

PR to fix here: #865

@marko-zivic-93
Copy link
Contributor

Hello @NullVoxPopuli,
Thank you for creating this issue and contributing with a PR, we will take a look and come back to you as soon as we have some news 😃

@Techn1x
Copy link

Techn1x commented Oct 10, 2023

I think the above poster ikjot161290 is a bot, not sure how to report comments on github..

@aparnajyothi-y
Copy link
Contributor

Hello @NullVoxPopuli, Released the PR yesterday.

For now I am going to close the issue. If you have any concerns feel free to ping us.

@NullVoxPopuli
Copy link
Contributor Author

Thatk you!

Already using the new version in:

https://github.com/marketplace/actions/all-in-one-setup-node-pnpm-cache

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

6 participants
@NullVoxPopuli @Techn1x @HarithaVattikuti @marko-zivic-93 @aparnajyothi-y and others