Unrecognized PORT command

Multi tool use
I am trying to run nodeJs on my localhost. Command used,
PORT=4080 node server.js
But, it was throwing an unexpected error.
'PORT' is not recognized as an internal or external command, operable
program or batch file.
Do I need to install any module or did I miss any syntax to run it properly?
node.js windows command-prompt
add a comment |
I am trying to run nodeJs on my localhost. Command used,
PORT=4080 node server.js
But, it was throwing an unexpected error.
'PORT' is not recognized as an internal or external command, operable
program or batch file.
Do I need to install any module or did I miss any syntax to run it properly?
node.js windows command-prompt
The above command is Unix (Ubuntu, Mac, etc…). In windows enviroment, you need a different syntax. Google something like "set env in windows command line"
– Subburaj
Dec 14 '17 at 5:52
I configured environment variable for nodeJs, If I runnode server.js
, It was running on port 3000. But I need to run it on port 4030. I thought, I need a module for the port but I didn't find anything related to that in google. I thought it would be useful for others if I raise this as an issue.
– kvk30
Dec 14 '17 at 5:56
You said you have configured for port 3000, you an change that configuration to 4080, it should work??
– Subburaj
Dec 14 '17 at 5:59
@Subburaj, It is a default port but I need to change it to 4080. For that configuration, I didn't find any article.
– kvk30
Dec 14 '17 at 6:01
add a comment |
I am trying to run nodeJs on my localhost. Command used,
PORT=4080 node server.js
But, it was throwing an unexpected error.
'PORT' is not recognized as an internal or external command, operable
program or batch file.
Do I need to install any module or did I miss any syntax to run it properly?
node.js windows command-prompt
I am trying to run nodeJs on my localhost. Command used,
PORT=4080 node server.js
But, it was throwing an unexpected error.
'PORT' is not recognized as an internal or external command, operable
program or batch file.
Do I need to install any module or did I miss any syntax to run it properly?
node.js windows command-prompt
node.js windows command-prompt
edited Dec 27 '18 at 16:34
asked Dec 14 '17 at 5:47


kvk30
492523
492523
The above command is Unix (Ubuntu, Mac, etc…). In windows enviroment, you need a different syntax. Google something like "set env in windows command line"
– Subburaj
Dec 14 '17 at 5:52
I configured environment variable for nodeJs, If I runnode server.js
, It was running on port 3000. But I need to run it on port 4030. I thought, I need a module for the port but I didn't find anything related to that in google. I thought it would be useful for others if I raise this as an issue.
– kvk30
Dec 14 '17 at 5:56
You said you have configured for port 3000, you an change that configuration to 4080, it should work??
– Subburaj
Dec 14 '17 at 5:59
@Subburaj, It is a default port but I need to change it to 4080. For that configuration, I didn't find any article.
– kvk30
Dec 14 '17 at 6:01
add a comment |
The above command is Unix (Ubuntu, Mac, etc…). In windows enviroment, you need a different syntax. Google something like "set env in windows command line"
– Subburaj
Dec 14 '17 at 5:52
I configured environment variable for nodeJs, If I runnode server.js
, It was running on port 3000. But I need to run it on port 4030. I thought, I need a module for the port but I didn't find anything related to that in google. I thought it would be useful for others if I raise this as an issue.
– kvk30
Dec 14 '17 at 5:56
You said you have configured for port 3000, you an change that configuration to 4080, it should work??
– Subburaj
Dec 14 '17 at 5:59
@Subburaj, It is a default port but I need to change it to 4080. For that configuration, I didn't find any article.
– kvk30
Dec 14 '17 at 6:01
The above command is Unix (Ubuntu, Mac, etc…). In windows enviroment, you need a different syntax. Google something like "set env in windows command line"
– Subburaj
Dec 14 '17 at 5:52
The above command is Unix (Ubuntu, Mac, etc…). In windows enviroment, you need a different syntax. Google something like "set env in windows command line"
– Subburaj
Dec 14 '17 at 5:52
I configured environment variable for nodeJs, If I run
node server.js
, It was running on port 3000. But I need to run it on port 4030. I thought, I need a module for the port but I didn't find anything related to that in google. I thought it would be useful for others if I raise this as an issue.– kvk30
Dec 14 '17 at 5:56
I configured environment variable for nodeJs, If I run
node server.js
, It was running on port 3000. But I need to run it on port 4030. I thought, I need a module for the port but I didn't find anything related to that in google. I thought it would be useful for others if I raise this as an issue.– kvk30
Dec 14 '17 at 5:56
You said you have configured for port 3000, you an change that configuration to 4080, it should work??
– Subburaj
Dec 14 '17 at 5:59
You said you have configured for port 3000, you an change that configuration to 4080, it should work??
– Subburaj
Dec 14 '17 at 5:59
@Subburaj, It is a default port but I need to change it to 4080. For that configuration, I didn't find any article.
– kvk30
Dec 14 '17 at 6:01
@Subburaj, It is a default port but I need to change it to 4080. For that configuration, I didn't find any article.
– kvk30
Dec 14 '17 at 6:01
add a comment |
3 Answers
3
active
oldest
votes
Another interesting thing the worked for me without using cross-env.
SET PORT=4080&& node server.js
PS: Set enviroment varible for nodeJs, run command in project folder.
This would cause your system variables to change, which is not very desirable.cross-env
solves this.
– Faizuddin Mohammed
Dec 14 '17 at 10:12
add a comment |
- Install this additional package cross-env in your node
environment. The above command you mentioned is Unix (Ubuntu, Mac,
etc…). In the windows environment, you need a different syntax and cross-env does your job. - You can also create an .env file with
PORT=3006
and save it in your
project directory.
Hey please check my answer and verify it :)
– kvk30
Dec 14 '17 at 6:22
add a comment |
SET PORT=8090 && nodemon server.js
that worked for me
I need to run port 4080
– kvk30
Oct 1 '18 at 7:06
Welcome to Stack Overflow! Please don't answer just with source code. Try to provide a nice description about how your solution works. See: How do I write a good answer?. Thanks
– sɐunıɔןɐqɐp
Oct 1 '18 at 7:23
If things dont work out this way, leave it likenodemon server.js
then in your terminal sayexport port=4080
(your choice port of course) thennpm nodemon
to start the server
– Mbanda
Oct 1 '18 at 13:13
@Mbanda Thanks for sharing your knowledge, unfortunately, I solved it and not tested with your explanation.
– kvk30
Dec 27 '18 at 16:37
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47806623%2funrecognized-port-command%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Another interesting thing the worked for me without using cross-env.
SET PORT=4080&& node server.js
PS: Set enviroment varible for nodeJs, run command in project folder.
This would cause your system variables to change, which is not very desirable.cross-env
solves this.
– Faizuddin Mohammed
Dec 14 '17 at 10:12
add a comment |
Another interesting thing the worked for me without using cross-env.
SET PORT=4080&& node server.js
PS: Set enviroment varible for nodeJs, run command in project folder.
This would cause your system variables to change, which is not very desirable.cross-env
solves this.
– Faizuddin Mohammed
Dec 14 '17 at 10:12
add a comment |
Another interesting thing the worked for me without using cross-env.
SET PORT=4080&& node server.js
PS: Set enviroment varible for nodeJs, run command in project folder.
Another interesting thing the worked for me without using cross-env.
SET PORT=4080&& node server.js
PS: Set enviroment varible for nodeJs, run command in project folder.
answered Dec 14 '17 at 6:18


kvk30
492523
492523
This would cause your system variables to change, which is not very desirable.cross-env
solves this.
– Faizuddin Mohammed
Dec 14 '17 at 10:12
add a comment |
This would cause your system variables to change, which is not very desirable.cross-env
solves this.
– Faizuddin Mohammed
Dec 14 '17 at 10:12
This would cause your system variables to change, which is not very desirable.
cross-env
solves this.– Faizuddin Mohammed
Dec 14 '17 at 10:12
This would cause your system variables to change, which is not very desirable.
cross-env
solves this.– Faizuddin Mohammed
Dec 14 '17 at 10:12
add a comment |
- Install this additional package cross-env in your node
environment. The above command you mentioned is Unix (Ubuntu, Mac,
etc…). In the windows environment, you need a different syntax and cross-env does your job. - You can also create an .env file with
PORT=3006
and save it in your
project directory.
Hey please check my answer and verify it :)
– kvk30
Dec 14 '17 at 6:22
add a comment |
- Install this additional package cross-env in your node
environment. The above command you mentioned is Unix (Ubuntu, Mac,
etc…). In the windows environment, you need a different syntax and cross-env does your job. - You can also create an .env file with
PORT=3006
and save it in your
project directory.
Hey please check my answer and verify it :)
– kvk30
Dec 14 '17 at 6:22
add a comment |
- Install this additional package cross-env in your node
environment. The above command you mentioned is Unix (Ubuntu, Mac,
etc…). In the windows environment, you need a different syntax and cross-env does your job. - You can also create an .env file with
PORT=3006
and save it in your
project directory.
- Install this additional package cross-env in your node
environment. The above command you mentioned is Unix (Ubuntu, Mac,
etc…). In the windows environment, you need a different syntax and cross-env does your job. - You can also create an .env file with
PORT=3006
and save it in your
project directory.
PORT=3006
PORT=3006
answered Dec 14 '17 at 6:03
go_gunner
213
213
Hey please check my answer and verify it :)
– kvk30
Dec 14 '17 at 6:22
add a comment |
Hey please check my answer and verify it :)
– kvk30
Dec 14 '17 at 6:22
Hey please check my answer and verify it :)
– kvk30
Dec 14 '17 at 6:22
Hey please check my answer and verify it :)
– kvk30
Dec 14 '17 at 6:22
add a comment |
SET PORT=8090 && nodemon server.js
that worked for me
I need to run port 4080
– kvk30
Oct 1 '18 at 7:06
Welcome to Stack Overflow! Please don't answer just with source code. Try to provide a nice description about how your solution works. See: How do I write a good answer?. Thanks
– sɐunıɔןɐqɐp
Oct 1 '18 at 7:23
If things dont work out this way, leave it likenodemon server.js
then in your terminal sayexport port=4080
(your choice port of course) thennpm nodemon
to start the server
– Mbanda
Oct 1 '18 at 13:13
@Mbanda Thanks for sharing your knowledge, unfortunately, I solved it and not tested with your explanation.
– kvk30
Dec 27 '18 at 16:37
add a comment |
SET PORT=8090 && nodemon server.js
that worked for me
I need to run port 4080
– kvk30
Oct 1 '18 at 7:06
Welcome to Stack Overflow! Please don't answer just with source code. Try to provide a nice description about how your solution works. See: How do I write a good answer?. Thanks
– sɐunıɔןɐqɐp
Oct 1 '18 at 7:23
If things dont work out this way, leave it likenodemon server.js
then in your terminal sayexport port=4080
(your choice port of course) thennpm nodemon
to start the server
– Mbanda
Oct 1 '18 at 13:13
@Mbanda Thanks for sharing your knowledge, unfortunately, I solved it and not tested with your explanation.
– kvk30
Dec 27 '18 at 16:37
add a comment |
SET PORT=8090 && nodemon server.js
that worked for me
SET PORT=8090 && nodemon server.js
that worked for me
answered Oct 1 '18 at 7:04


Mbanda
494
494
I need to run port 4080
– kvk30
Oct 1 '18 at 7:06
Welcome to Stack Overflow! Please don't answer just with source code. Try to provide a nice description about how your solution works. See: How do I write a good answer?. Thanks
– sɐunıɔןɐqɐp
Oct 1 '18 at 7:23
If things dont work out this way, leave it likenodemon server.js
then in your terminal sayexport port=4080
(your choice port of course) thennpm nodemon
to start the server
– Mbanda
Oct 1 '18 at 13:13
@Mbanda Thanks for sharing your knowledge, unfortunately, I solved it and not tested with your explanation.
– kvk30
Dec 27 '18 at 16:37
add a comment |
I need to run port 4080
– kvk30
Oct 1 '18 at 7:06
Welcome to Stack Overflow! Please don't answer just with source code. Try to provide a nice description about how your solution works. See: How do I write a good answer?. Thanks
– sɐunıɔןɐqɐp
Oct 1 '18 at 7:23
If things dont work out this way, leave it likenodemon server.js
then in your terminal sayexport port=4080
(your choice port of course) thennpm nodemon
to start the server
– Mbanda
Oct 1 '18 at 13:13
@Mbanda Thanks for sharing your knowledge, unfortunately, I solved it and not tested with your explanation.
– kvk30
Dec 27 '18 at 16:37
I need to run port 4080
– kvk30
Oct 1 '18 at 7:06
I need to run port 4080
– kvk30
Oct 1 '18 at 7:06
Welcome to Stack Overflow! Please don't answer just with source code. Try to provide a nice description about how your solution works. See: How do I write a good answer?. Thanks
– sɐunıɔןɐqɐp
Oct 1 '18 at 7:23
Welcome to Stack Overflow! Please don't answer just with source code. Try to provide a nice description about how your solution works. See: How do I write a good answer?. Thanks
– sɐunıɔןɐqɐp
Oct 1 '18 at 7:23
If things dont work out this way, leave it like
nodemon server.js
then in your terminal say export port=4080
(your choice port of course) then npm nodemon
to start the server– Mbanda
Oct 1 '18 at 13:13
If things dont work out this way, leave it like
nodemon server.js
then in your terminal say export port=4080
(your choice port of course) then npm nodemon
to start the server– Mbanda
Oct 1 '18 at 13:13
@Mbanda Thanks for sharing your knowledge, unfortunately, I solved it and not tested with your explanation.
– kvk30
Dec 27 '18 at 16:37
@Mbanda Thanks for sharing your knowledge, unfortunately, I solved it and not tested with your explanation.
– kvk30
Dec 27 '18 at 16:37
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47806623%2funrecognized-port-command%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
N FPq DzeC7 UPRkNgYjUiPgd 1ShO0kUYx8rnYVCPzszMMcuQI,Cyi5DCmYr93AzAGka7,4t3LoC
The above command is Unix (Ubuntu, Mac, etc…). In windows enviroment, you need a different syntax. Google something like "set env in windows command line"
– Subburaj
Dec 14 '17 at 5:52
I configured environment variable for nodeJs, If I run
node server.js
, It was running on port 3000. But I need to run it on port 4030. I thought, I need a module for the port but I didn't find anything related to that in google. I thought it would be useful for others if I raise this as an issue.– kvk30
Dec 14 '17 at 5:56
You said you have configured for port 3000, you an change that configuration to 4080, it should work??
– Subburaj
Dec 14 '17 at 5:59
@Subburaj, It is a default port but I need to change it to 4080. For that configuration, I didn't find any article.
– kvk30
Dec 14 '17 at 6:01