6
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

nodebrew install-binary latestを実行したときにFailed to create the fileが発生する場合

Posted at

nodebrewのインストール後に最新版のnode.jsとmpnをインストールしようとしたときのエラー対応の備忘録です。

環境

macOS High Sierra(10.3.6)
nodebrew 1.0.1

実行コマンド

  • brew install nodebrew
hogePC:~ hoge$ brew install nodebrew
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
〜〜〜中略〜〜〜
==> Summary
🍺  /usr/local/Cellar/nodebrew/1.0.1: 8 files, 38.6KB, built in 6 seconds
  • nodebrew -v
hogePC:~ hoge$ nodebrew -v
nodebrew 1.0.1

nodebrewのインストールは成功したようです。

  • nodebrew install-binary latest
hogePC:~ hoge$ nodebrew install-binary latest
Fetching: https://nodejs.org/dist/v12.1.0/node-v12.1.0-darwin-x64.tar.gz
Warning: Failed to create the file 
Warning: /Users/hoge/.nodebrew/src/v12.1.0/node-v12.1.0-darwin-x64.tar.gz: No 
Warning: such file or directory
                                                                           0.0%
curl: (23) Failed writing body (0 != 1058)
download failed: https://nodejs.org/dist/v12.1.0/node-v12.1.0-darwin-x64.tar.gz

うーん、node.jsとnpmのインストールに失敗してますね。

原因と解決

brew install nodebrew を実行したときのメッセージを再度読んでみると以下のような記述がありました。

You need to manually run setup_dirs to create directories required by nodebrew:
  /usr/local/opt/nodebrew/bin/nodebrew setup_dirs

Add path:
  export PATH=$HOME/.nodebrew/current/bin:$PATH

手動でnodebrew setup_dirsを実行してね。との記載がありました。
なので、以下のコマンドを実行しました。

hogePC:~ hoge$ cd /usr/local/opt/nodebrew/bin/
hogePC:bin hoge$ nodebrew setup_dirs

再度、nodebrew install-binary latestを実行。

hogePC:~ hoge$ nodebrew install-binary latest
Fetching: https://nodejs.org/dist/v12.1.0/node-v12.1.0-darwin-x64.tar.gz
〜〜〜中略〜〜〜〜
######## 100.0%
Installed successfully

無事、インストール完了!

6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?