can't brew install node

后端 未结 12 944
无人及你
无人及你 2020-12-13 06:35

I am trying to upgrade my node via homebrew but ran into a problem because I think I tried to download through the website. I am very new to terminal. I\'ve tried to search

相关标签:
12条回答
  • 2020-12-13 06:46

    For those running high sierra on MacOS:

    I tried giving permissions using the chown command and uninstalling then reinstalling node via homebrew but nothing worked.

    I just went to this site https://nodejs.org/en/download/ and downloaded the 64 bit macOS .pkg and it worked perfectly. I tested it by just entering the command node in terminal.

    0 讨论(0)
  • 2020-12-13 06:48

    For me I had to run brew doctor which showed me that I did not have write access and had to run sudo chown -R $(whoami) /usr/local/bin /usr/local/share /usr/local/share/man to fix the issue.

    I suggest running brew doctor to see if it can provide some hints on the issue

    0 讨论(0)
  • 2020-12-13 06:49

    I had the same error:

    Linking /usr/local/Cellar/node/11.10.0...
    Error: Could not symlink include/node /usr/local/include is not writable.
    

    Solution:

    $ sudo mkdir /usr/local/include
    $ sudo chown -R $(whoami) $(brew --prefix)/*
    $ brew link node
    

    Linking /usr/local/Cellar/node/11.10.0... 7 symlinks created

    $ node -v => v11.10.0

    $ npm -v => 6.7.0

    0 讨论(0)
  • 2020-12-13 06:49

    I had a very similar problem with linking. I couldn't get it to work. I tried to chmod /usr/local/include/node so I could write the link to it but ran into another error. As a final solution, I just reinstalled node from https://nodejs.org/download/

    I have a working node prompt again! I would love to go through brew to update but it saved me a lot of hassle just using the pkg installer from the site. I know this may not be the solution you are looking for but I just wanted to share my experience with the same issue. I hope it helps!

    0 讨论(0)
  • 2020-12-13 06:55

    You need to make /usr/local/bin and /usr/local/share writable. I used this answer to achieve this. Below is the key advice in the answer replicated in case the link breaks:

    sudo chown -R `whoami`:admin /usr/local/bin
    sudo chown -R `whoami`:admin /usr/local/share
    
    0 讨论(0)
  • 2020-12-13 06:57

    There are two steps involved.

    1. Simply run these four commands:
        sudo chown -R `whoami`:admin /usr/local/include/node
        sudo chown -R `whoami`:admin /usr/local/bin
        sudo chown -R `whoami`:admin /usr/local/share
        sudo chown -R `whoami`:admin /usr/local/lib/dtrace 
    
    1. Finally, run the overwrite command:
        brew link --overwrite node
    
    0 讨论(0)
提交回复
热议问题