-
-
Notifications
You must be signed in to change notification settings - Fork 742
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
macOS Sierra ask for firewall after install any Node Version with "n" #394
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
What version of N do you have? I'm trying to reproduce the error. Since it's macOS sierra, I can't run it in a container to see how it got there. |
I'm running with the latest version of N. Though npm lists it as 2.1.4 while n itself only reports 2.1.3:
Any time I run a version of node that was installed via N, I get the macOS firewall warning about allowing or denying the application: Unfortunately it does not seem to remember than I have allowed it, since it asks every time I run any node application. If I remove N and all of its installed versions, and go back to the bundled installer from nodejs.org I don't get the warnings. I'm assuming it's got something to do with signed code, or lack of signed code on N-installed versions? |
This issue has been bugging me fore a while now too. I thought I found the solution by adding
Quite annoying, especially when you have a watcher that restarts your node server on changes, you have to click away the message each time. Also, same issue with the
|
I'll note that somehow, there was never a similar issue reported with nvm. Just thought it'd be relevant. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The problem has been fixed for me after I restarted macOS. 😅 |
This isn't an issue with I was able temporarily removed the issue by:
The issue comes back once you switch node versions again using Super weird and very frustrating. Hope this helps anyone traveling down this rabbit hole. |
Had the same problem, solved it this way:
Now, no matter how many times n switches versions, the firewall entry is intact, and no more 'Deny ... Allow' prompts. Root Cause: Not really sure, but it appears n does an incomplete copy into
It seems n just doesn't copy all the meta information about the node executable. Also, the latest version of n (as of this writing) takes a very long time to switch versions... which along with the created date being reset might imply that n is doing its own byte copy instead of letting the OS do the work. The source for the n script indicates otherwise (issues a But... once Firewall Options adds at least one good entry for |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@janur The magic command for navigating to the correct path is |
This comment has been minimized.
This comment has been minimized.
I tried the same fix mentioned above but using
(man page) I tried doing the copy with the -p option and it seems to fix the issue just like the manual Finder copy. So I propose that n should be updated to use |
I was looking for a quick way to fix this every time I switched versions with # remove current entry in firewall
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --remove /usr/local/bin/node && \
# copy current node from n
cp -pf /usr/local/n/versions/node/$(node -v | cut -d 'v' -f 2)/bin/node /usr/local/bin && \
# add to firewall
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/local/bin/node |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I ran into this just now was able to fix it by forcibly signing the node binary as discussed in this stack overflow answer. https://apple.stackexchange.com/a/150711/14941
|
This comment has been minimized.
This comment has been minimized.
This is how I fixed this problem without restarting macOS: First I ran @glenjamin's command: I don't know if it helped, it didn't solve my problem, but maybe it's a combination of that command and what I did, so I'm including it. Then I performed these steps:
Hope that helps someone. |
I've never installed |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I worked this into some local scripts I use for easy reuse. And eventually other people kept asking me, so I made it into a simple set of scripts that always seems to do the trick for this issue. Thought it might be helpful to post since it's just a paste and go sorta deal now.
|
This comment has been minimized.
This comment has been minimized.
Two years later, @slhenty still works. I'm using node >12 |
These 3 lines definitely work... would be cool if there was a hook somewhere after in the absence of that, I added this to my
then I just run
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Had the same issue on macOS 10.14.6 (18G103), the workaround did the job. n@6.0.1 |
This comment has been minimized.
This comment has been minimized.
All of the above works, but when you restart the machine, it's still a problem. |
Have the issue on 10.15.2, using @initplatform 's solution |
I have reproduced the problem on macOS 10.15.2, but failed to make sense of what the firewall is doing. In particular in a folder with a simple server and the firewall on:
Running the node as installed using the installer from nodejs.org does not cause a firewall prompt. |
I may have stumbled on a solution. Deleting the previous node binary before doing the copy seems to be working. (i.e. apparently copying the binary over the top of the existing binary makes the firewall unhappy.) e.g.
|
Deleting the node binary before installing with I am keen to know if this also works for other people, including on older OS. |
Hopefully fixed in |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Confirming @shadowspawn 's suggestion of deleting |
this works |
Similar to #199 (old issue solved) I note that after install "n" and use to switch between versions the firewall ask for permissions (Because I'm using also ExpressJs for an API Rest). The msg is "Do you want the application “node” to accept incoming network connections?"
I try to re install node and it's work normal, but if I switch with "n" (2.1.3), the problem start again.
The text was updated successfully, but these errors were encountered: