Programing

오류 : 'brew link'단계가 성공적으로 완료되지 않았습니다

lottogame 2020. 6. 9. 07:38
반응형

오류 : 'brew link'단계가 성공적으로 완료되지 않았습니다


Homebrew를 통해 node.js를 설치하려고합니다. 불행히도이 오류가 발생합니다.

➜  ~  brew install node
==> Downloading http://nodejs.org/dist/v0.8.10/node-v0.8.10.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/node/0.8.10
==> make install
==> Caveats
Homebrew installed npm.
We recommend prepending the following path to your PATH environment
variable to have npm-installed binaries picked up:
  /usr/local/share/npm/bin
Warning: Could not link node. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link node'
==> Summary
/usr/local/Cellar/node/0.8.10: 856 files, 13M, built in 103 seconds

그런 다음 노드를 수동으로 연결하려고합니다 ...

➜  ~  brew link node
Linking /usr/local/Cellar/node/0.8.10... Warning: Could not link node. Unlinking...

Error: Could not symlink file: /usr/local/Cellar/node/0.8.10/lib/node_modules/npm/scripts/relocate.sh
Target /usr/local/lib/node_modules/npm/scripts/relocate.sh already exists. You may need to delete it.
To force the link and delete this file, do:
  brew link -f formula_name

To list all files that would be deleted:
  brew link -n formula_name

운이 없어서 강제로 노드를 연결하려고합니다 ...

➜  ~  brew link -f node
Linking /usr/local/Cellar/node/0.8.10... Warning: Could not link node. Unlinking...

Error: Permission denied - /usr/local/lib/dtrace/node.d

나는 어떤면에서 dtrace에 익숙하지 않으며 권한을 엉망으로 만드는 것을 두려워하므로 sudo ..

➜ ~ git:(master) sudo brew link -f node
Password:
Error: Cowardly refusing to `sudo brew link'
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.

통해 노드를 제거 brew uninstall node하고 운없이 설치를 다시 시도했습니다.


node.js의 homebrew 패키지에 npm이 다시 포함되므로 독립형 버전을 먼저 제거하는 homebrew 패키지의 메시지를 놓쳤을 때 이런 일이 발생했습니다.

가정, 나처럼, 당신은 이미로 알고 전에 업그레이드를 시도하여 노드 / 고궁 박물원을 깼다 npm uninstall npm -g첫째, 당신이 할 수있는 rm -rf /usr/local/lib/node_modules/npm다음 brew link node. 이렇게하면 독립형 자체 호스팅 npm 패키지 (브루어를 설치하려는 것이 아니라)가 제거되고 브루어는 번들로 묶인 패키지를 Cellar에서 심볼릭 링크 할 수 있습니다.


Mac OS X Mavericks를 실행합니다. 노드 0.10.25를 설치하려고 시도했지만 최상위 답변이 작동하지 않았습니다.

natevw는에 말한다 rm -rf /usr/local/lib/node_modules/npm에 대한 사용 권한 만있는 경우 /usr/local/lib/node_modules다음과 같이 :

drwxr-xr-x   3 root      admin   102 Feb  2 20:45 node_modules

brew는 해당 디렉토리에 npm 심볼릭 링크를 만들 수 없습니다. 내 해결책은 다음과 같습니다.

1 단계 : Homebrew 업데이트

$ brew update

2 단계 : 시스템 어디에서나 node / npm 제거

이러한 명령 중 일부는 과거에 node / npm을 설치 한 방법에 따라 필요하지 않습니다.

$ brew uninstall npm
$ brew uninstall node
$ npm uninstall npm -g
$ sudo rm -rf /usr/local/lib/node_modules

참고 : 나는 실행하여 찾은 길 잃은 노드 파일을 가지고 있었다 brew -v link node(이것은 brew가 불평하는 연결 오류의 자세한 결과를 주었다). 다음이 필요할 수 있습니다.

$ sudo rm -rf /usr/local/include/node
$ sudo rm -rf /usr/local/lib/node

3 단계 : 새 터미널을 열고 노드 설치

$ brew install node

sudo chown -R $(whoami) /usr/local 

추출 사이트 문제 해결에서 언급 한대로 잘 작동합니다.

https://github.com/Homebrew/homebrew/wiki/troubleshooting


다른 방법을 사용하여 이전 버전의 node.js를 이미 설치했을 수 있으므로 추출중인 파일을 수동으로 제거해야합니다.

brew link -n node수동으로 그 충돌 파일과 디렉토리를 삭제 한 후 시도 brew link node다시.


나는 조금 늦었다. 나를 위해 일한 것은 이것이었다 :

* npm uninstall npm -g

* brew uninstall node

* brew install node

* sudo rm -rf /usr/local/lib/dtrace/node.d

* brew link node (caused error with permissions)

* sudo chmod 777 /usr/local/lib/dtrace/node.d

* brew link node

이 순서 후에 모든 것이 성공했습니다


이 시도. 다른 참조에서 얻었고 나를 위해 일했습니다.

sudo brew uninstall node
brew update
brew upgrade
brew cleanup
brew install node
sudo chown -R $(whoami) /usr/local
brew link --overwrite node
sudo brew postinstall node

모든 이전 응용 프로그램을 이전 Mac에서 새 응용 프로그램으로 전송 한 후에도 동일한 문제가 발생했습니다.

I found the solution by running brew doctor :

Warning: Broken symlinks were found. Remove them with brew prune

After running brew prune, Homebrew is finally back on track :)


My problem had a slightly different solution. The directory in which brew wanted to create the symlinks were not owned by the current user.

ls -la /usr/local/bin/lib/node | grep node yielded:

drwxr-xr-x    3 24561  wheel   102 May  4  2012 node
drwxr-xr-x    7 24561  wheel   238 Sep 18 16:37 node_modules

For me, the following fixed it:

sudo chown $(users) /usr/local/bin/lib/node_modules
sudo chown $(users) /usr/local/bin/lib/node

ps. $(users) will get expanded to your username, went a little out of my way to help out lazy copy pasters ;)


thx @suweller.

I fixed the problem:

➜  bin git:(master) ✗ brew link node
Linking /usr/local/Cellar/node/0.10.25... Warning: Could not link node. Unlinking...

Error: Permission denied - /usr/local/lib/node_modules/npm

I had the same problem as suweller:

➜  bin git:(master) ✗ ls -la /usr/local/lib/ | grep node
drwxr-xr-x   3 24561  wheel   102 11 Okt  2012 node
drwxr-xr-x   3 24561  wheel   102 27 Jan 11:32 node_modules

so i fixed this problem by:

➜  bin git:(master) ✗ sudo chown $(users) /usr/local/lib/node_modules
➜  bin git:(master) ✗ sudo chown $(users) /usr/local/lib/node

after i fixed this problem I got another one:

➜  bin git:(master) ✗ brew link node
Linking /usr/local/Cellar/node/0.10.25... Warning: Could not link node. Unlinking...

Error: Could not symlink file: /usr/local/Cellar/node/0.10.25/lib/dtrace/node.d
Target /usr/local/lib/dtrace/node.d already exists. You may need to delete it.
To force the link and overwrite all other conflicting files, do:
  brew link --overwrite formula_name

To list all files that would be deleted:
  brew link --overwrite --dry-run formula_name

So I removed node.d by:

➜  bin git:(master) ✗ sudo rm /usr/local/lib/dtrace/node.d

got another permission error:

➜  bin git:(master) ✗ brew link node
Linking /usr/local/Cellar/node/0.10.25... Warning: Could not link node. Unlinking...

Error: Could not symlink file: /usr/local/Cellar/node/0.10.25/lib/dtrace/node.d
/usr/local/lib/dtrace is not writable. You should change its permissions.

and fixed it:

➜  bin git:(master) ✗ sudo chown $(users) /usr/local/Cellar/node/0.10.25/lib/dtrace/node.d

and finally everything worked:

➜  bin git:(master) ✗ brew link node
Linking /usr/local/Cellar/node/0.10.25... 1225 symlinks created

Most brew install issues with node are caused by permission errors or having node previously installed and then trying to install it via brew. The solution that worked for me finally was:

WARNING: This will uninstall nodejs (multiple versions) use with caution:

  1. Remove node via brew:

    brew uninstall node

  2. also did via force:

    brew uninstall node --force

  3. To use the script Source: Remove node:

    curl -O https://raw.githubusercontent.com/DomT4/scripts/master/OSX_Node_Removal/terminatenode.sh

Then:

chmod +x /path/to/terminatenode.sh

Then:

./terminatenode.sh .
  1. Then make sure to do the following command:

    chown $USER /usr/local

  2. Then do a brew update (keep doing this until all things are updated):

    brew update

  3. Clean brew up and run update again (might be redundant) and run doctor to make sure things are in place:

    brew cleanup; brew update; brew doctor

  4. And finally install node via brew (verbose):

    brew install -v node


the ultimate answer: change the owner of that directory to whoever you are

sudo chown -R `whoami` /usr/local/include

which is also recommended by brew if you run brew doctor


I also managed to mess up my NPM and installed packages between these Homebrew versions and no matter how many time I unlinked / linked and uninstalled / installed node it still didn't work.

As it turns out you have to remove NPM from the path otherwise Homebrew won't install it: https://github.com/mxcl/homebrew/blob/master/Library/Formula/node.rb#L117

Hope this will help someone with the same problem and save that hour or so I had to spend looking for the problem...


by the Finder, Delete this file:

/usr/local/lib/dtrace/node.d

in terminal:

$ brew link --overwrite --dry-run node

then:

$ brew link node

I was getting an error while installation that not able to link node and /usr/local/include is not writable

Below solution worked for me :- First create the include folder, note that this requires sudo privileges

cd /usr/local

sudo mkdir include

sudo chown -R $(whoami) $(brew --prefix)/*

brew link node

Don't know, if it's a good idea or not: After trying all other solutions without success, I just renamed /usr/local/lib/dtrace, linked node and re-renamed the directory again. After that, node worked as expected.


I was struggling with this for a while. (for me "npm uninstall npm -g" did nothing)

I tried a bunch of things:

npm uninstall npm -g
brew uninstall node
brew install node

I was still having some issues and was getting errors when i tried to link the node files

Finally i tried this

brew link --overwrite node

That seemed to have fixed it. (it overwrites al the conflicting files and also links node and npm)

Hope this helps


I completely uninstalled brew and started again, only to find the same problem again.

Brew appears to work by symlinking the required binaries into your system where other installation methods would typically copy the files.

I found an existing set of node libraries here:

/usr/local/include/node

After some head scratching I remembered installing node at the date against this old version and it hadn't been via brew.

I manually deleted this entire folder and successfully linked npm.

This would explain why using brew uninstall or even uninstall brew itself had no effect.

The highest ranked answer puts this very simply, but I thought I'd add my observations about why it's necessary.

I'm guessing a bunch of issues with other brew packages might be caused by old non-brew instances of packages being in the way.


Had been wrecking my head on symlinking node .. and nothing seemed to work...but finally what worked is setting the right permissions . This 'sudo chown -R $(whoami) /usr/local' did the work for me.


I fixed this in El Capitan by using the following command. Honestly, no idea what it does, but thought I'd share since it fixed my problem.

brew link --overwrite node

You need to remove the npm package manually.

first unlink node: brew link -n node

remove npm folder: rm -R /usr/local/Cellar/node/0.8.10/lib/node_modules/npm

link again: brew link node

there will be a soft link to the new location of npm

참고URL : https://stackoverflow.com/questions/12607155/error-the-brew-link-step-did-not-complete-successfully

반응형