Skip to content

Node.js shebang line and NODE_OPTIONS #109

@megastef

Description

@megastef

Hi,

  1. I wonder if there is a better way to pass NODE_OPTIONS to node cli. It turned out we need in production custom memory settings or good defaults (lowering resource usage).

So I find myself in writing long shebang lines for node.js scripts, e.g.
https://github.com/sematext/logagent-js/blob/master/bin/logagent.js#L1-L5

#!/bin/sh
':' //; export MAX_MEM="--max-old-space-size=100"; exec "$(command -v node || command -v nodejs)" "${NODE_OPTIONS:-$MAX_MEM}" "$0" "$@" 

Is there something like .noderc, or interpretation of an environment variable like NODE_OPTIONS by the node executable to pass runtime options?

  1. Some people reported that options are given by option mames with underscore e.g. --max_old_space_size=100 (Maybe on CentOS ...). How could I find out which naming scheme (dash vs. underscore) is used?
  2. I ignore windows .. for now :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions