0
0

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 3 years have passed since last update.

nodejs: "TypeError: Invalid hex string"が起きた時に確認すること

0
Last updated at Posted at 2017-06-13

new Buffer()"TypeError: Invalid hex string"にハマったときのメモです。
結論、自分の場合は.envファイル内の各行末の「余分な空白」を削除するで解決しました。

環境

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.12.5
BuildVersion:	16F73

$ node -v
7.10.0

問題点

var buf = new Buffer(process.env.FOO_KEY, 'hex'); // <= ここでエラー

解決方法

// vim .env
BAR_KEY = "abc"
FOO_KEY = "123456789abcdef" // <= 行末に余分な空白があったら削除
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?