swift
swift copied to clipboard
ReferenceError: fetch is not defined on MacOS
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
Not sure how you control your instance of Node - but it will need updating to get rid of this issue
@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
Having the same issue on remote gitlab runner. Everything is managed by brew there. Node version is 22.2
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
The issue has been solved by https://github.com/danger/danger-js/issues/1448