what worked for me:
npm start >> log.txt 2>> log.txt
>> log.txt
to redirect stdout
to the file
2>> log.txt
to redirect stderr
to the file
others use the shorthand &>>
for both stdout
and stderr
but it's not accepted by both my mac and ubuntu :(
extra: >
overwrites, while >>
appends