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

ReferenceError: fetch is not defined on MacOS #608

Closed
SvenMuc opened this issue May 3, 2024 · 5 comments
Closed

ReferenceError: fetch is not defined on MacOS #608

SvenMuc opened this issue May 3, 2024 · 5 comments

Comments

@SvenMuc
Copy link

SvenMuc commented May 3, 2024

I installed danger-swift with homebrew on my MacBookPro M3.

When I run e.g. danger-swift pr https://xxx/merge_requests/300 I receive the following error message.
The same error message appears in my Gitlab based CI pipeline with danger-swift ci --remove-previous-comments --verbose --trace-warnings

Any ideas what's going wrong?

Error:  ReferenceError: fetch is not defined
    at defaultRequestHandler (/snapshot/danger-js/node_modules/@gitbeaker/rest/dist/index.js:101:22)
    at Object.requester.<computed> [as get] (/snapshot/danger-js/node_modules/@gitbeaker/requester-utils/dist/index.js:53:16)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at process.runNextTicks [as _tickCallback] (node:internal/process/task_queues:65:3)
    at Function.runMain (pkg/prelude/bootstrap.js:1980:13)
    at node:internal/main/run_main_module:17:47
    at async /snapshot/danger-js/node_modules/@gitbeaker/core/dist/index.js:105:22

I also tested again the public repo mentioned in Getting Started with Danger - Test Locally. Same issue. Seems it has to do something with my macOS setup.

danger-swift pr https://github.com/danger/swift/pull/146

@orta
Copy link
Member

orta commented May 3, 2024

Not sure how you control your instance of Node - but it will need updating to get rid of this issue

@SvenMuc
Copy link
Author

SvenMuc commented May 5, 2024

@orta I haven't installed Node at all. I just installed danger globally as I did it on my old MacBook a year ago. I followed these instructions.

https://danger.systems/swift/guides/getting_started#homebrew

I also tried to install latest node version vie brew. But without any effect.

I just saw at danger-js that there was a major release change in the node engine. Does danger-swift relies on danger-js?

https://github.com/danger/danger-js/releases

@Jeepston
Copy link

Having the same issue on remote gitlab runner. Everything is managed by brew there. Node version is 22.2

@hujunfeng
Copy link

Same issue when running danger-swift pr.

> node --version
v22.2.0
> which node
/opt/homebrew/bin/node
> danger-swift --version
3.18.1
> which danger-swift
/opt/homebrew/bin/danger-swift

@SvenMuc
Copy link
Author

SvenMuc commented May 21, 2024

The issue has been solved by danger/danger-js#1448

@SvenMuc SvenMuc closed this as completed May 21, 2024
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

4 participants