0

I have a npm start script like this:

"start": "NODE_ENV=development PORT=3003 nodemon app.js"

but when I run it I get the following output:

'NODE_ENV' is not recognized as an internal or external command,

I am using VSCode with Powershell, does anyone know why this doesn't work?

4 Answers 4

1

Use

SET NODE_ENV=development
PORT=3003
nodemon app.js

for windows. The one you tried works for Linux

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

1 Comment

Now I don't get an error, but nodemon doesn't run app.js for some reason.
1

This command works fine on linux, but windows does not recognize the NODE_ENV command. to fix this install this package globally :

npm install -g win-node-env

see win-node-env

Comments

0

This command works fine in linux, for windows use:-

  "start": "set NODE_ENV=development&&PORT=3003&&nodemon app.js"

Comments

0

Install cross-env as dev dependency which run scripts that set and use environment variables across platforms

npm i cross-env -D

Change to this :

"start": "cross-env NODE_ENV=development PORT=3003 nodemon app.js"

Best solution will be to use dotenv to save environment variables

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.