How do I fix "ReferenceError: System is not defined" when running script from command line?

If you want to use module 'system' at server side - you will have to install systemjs package and configure it:

import System = require('systemjs');

System.config({
  ...
});

System.import(...);

But in my opinion it would be better to target commonjs and run it 'natively' in node.js without any extra dependencies.

As a bonus - you can also run commonjs module in browser using systemjs as loader - it supports loading them out of the box.

[EDIT]

Note that node.js is build with commonjs as module standard. Therefore you can consume 'system' modules using SystemJS but only 'inside' your main program that must be in commonjs format to be able to run in nodejs.