LoginSignup
5
3

More than 5 years have passed since last update.

Raspberry Piのlocale settingsでWarningが出るのを解消してnodebrewを使う

Posted at

Raspiにnodebrewを使ってNode.jsを入れようとしたときの内容です。

perlのlocaleエラーらしいですね。前に調べたことがある気がしたけど取り急ぎまとめてみます。

環境

  • Raspberry Pi 3
$ uname -a
Linux raspberry 4.14.34-v7+ #1110 SMP Mon Apr 16 15:18:51 BST 2018 armv7l GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 9.4 (stretch)
Release:    9.4
Codename:   stretch

症状

nodebrewを使うと毎回以下の警告が出ます。

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01   LC_CTYPE = "ja_JP.UTF-8",
    LANG = "en_GB.UTF-8"

以下の手順でv10.1.0を利用しようとしても

$ nodebrew install-binary 10.1.0
$ nodebrew use 10.1.0

デフォルトで入っているv4.8.2が表示されてしまいます。

$ node -v
v4.8.2

もともと入ってたnodeコマンドを削除

$ sudo rm rf /usr/bin/node

パスも通したけどうまくいかず

対処

Ubuntuのlocaleが正しく設定されていない時の対処メモ

を参考に

$ sudo locale-gen ja_JP.UTF-8
$ sudo dpkg-reconfigure locales

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "ja_JP.UTF-8",
    LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_GB.UTF-8").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory

Generating locales (this might take a while)...
  en_GB.UTF-8... done
  ja_JP.UTF-8... done
Generation complete.

ここでja_JP.UTF-8 UTF-8にチェックを入れてOKで完了です。

最後も同様です。

これで警告が消えました。

$ sorce .bashrc
$ which node
/home/pi/.nodebrew/current/bin/node
$ node -v
v10.1.0

これで完了です。

5
3
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
5
3