0

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.

1 Answer 1

1

This works differently on Windows.

Try the following:

SET NODE_ENV=production
node index.js

This setup might solve your problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.