Reputation: 1
I'm currently following a node.js course on skillshare, which works with a config file to determine what port a http or https server should run on. To do this, the variable "NODE_ENV" is being passed via the command-line at runtime. The value of this variable in turn determines what port the server runs on.
I've copied the code from the course's github, this way it shouldn't be a fault in the code.
However, when I try to pass the variable through with the exact same command as the video shows (NODE_ENV=production node index.js
), I get an error:
'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.
The only difference between me and the course should be that I'm working on Windows (10), while they are working on a MacBook.
I've tried including the NODE_ENV
variable behind the node index.js
, but this didn't work.
Upvotes: 0
Views: 88
Reputation: 443
This works differently on Windows.
Try the following:
SET NODE_ENV=production
node index.js
This setup might solve your problem.
Upvotes: 1