-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
[BUG] Error: ReferenceError: fetch is not defined #1448
Comments
If I run this through yarn it works fine, so I guess this could be something to do with installing through brew? |
Yeah, brew must be referencing an old node version somehow |
I had the same issue with danger-swift installed via brew. |
Aye that’s right, it does. I do have node installed though. If I do Looking at the brew manifest, all it does is download the latest bin from here. Running that same bin manually works fine. I’m really not sure why installing it through brew uses an old version. All I can think is perhaps there’s something in my PATH that is getting intercepted early by the brew installation but not the manual one. |
Speculation: do you install node via brew? (Or instead nvm/nodeenv or other tools?) I'd expect brew's install of node to supersede other tools during brew-installs, or at least that was what I saw years ago when I debugged a similar issue. My solution was to uninstall brew-based node so the only node on my system came from my node-manager. |
That’s a really good question. Yeah I installed it with brew. I’ll look and see tomorrow how to install it a different way and try that! |
If that helps, on my machine I installed no node js at all. I just installed danger by
this installs danger-js and danger-swift
|
I’ve never written a Homebrew Tap; could it be that neither tap expresses a Node dependency?
So either we’re getting node from the OS, node from Xcode, or node randomly from other brew state? |
So interestingly, I get the same error even if node is not installed.
Does the compiled binary version come with node bundled? |
Good guess, looks like it does: https://github.com/danger/danger-js/blob/main/package.json#L69-L70 - https://github.com/yao-pkg/pkg-fetch is a fork which supports node 18 |
This one is on me - sorry for this! For the testing of the GitLab changes I made I was running with a custom I believe it should suffice for now to simply update those I can submit a pull request for this. |
I can confirm the fix. |
This is amazing, thank you! |
Describe the bug
After updating to Danger JS 12.x I'm unable to run Danger.
To Reproduce
Steps to reproduce the behavior:
brew install danger/tap/danger-js
Expected behavior
I expected Danger to work as I have a node version installed greater than the minimum.
Screenshots
If applicable, add screenshots to help explain your problem.
Your Environment
Additional Context
We run this in an iOS project without any JS dependencies, and I'm not too familiar with JS, so forgive me if this is a trivial issue to solve for an experienced JS engineer!
The text was updated successfully, but these errors were encountered: