In our CentOS server, the env variable NODE_OPTIONS was set to a wrong value. I checked some possible files such as /etc/environment, /etc/profile, but no luck. I also tried to grep it from /etc/, still no luck. This makes me upset.
I even tried this: https://unix.stackexchange.com/a/154971/92712
Surprised to find that there's no such variable in the output. But it is in
printenv NODE_OPTIONS
set | grep NODE_OPTIONS
echo $NODE_OPTIONS
(shell is bash)
Is there any way to get in which file the this NODE_OPTIONS comes from?
More info:
$ node -v
node: invalid value for NODE_OPTIONS (unterminated string)
$ echo $NODE_OPTIONS
--max-old-space-size=5120"
$ cat /etc/environment
export NODE_OPTIONS="--max-old-space-size=5120"
Update:
Thanks @ilkkachu
$ declare -p NODE_OPTIONS
declare -x NODE_OPTIONS="--max-old-space-size=5120\" "
update 2: The extra double quotation appears in env output too:
$ env
NODE_OPTIONS=--max-old-space-size=5120"
update 3: Thanks @Johan Myréen
$ od -c /etc/environment
0000000 \n e x p o r t N O D E _ O P T
0000020 I O N S = " - - m a x - o l d -
0000040 s p a c e - s i z e = 5 1 2 0 "
0000060 # i n c r e a s e t o 5 g
0000100 b \n \n
0000103