Alterando a porta 3000 de um projeto em React ou NodeJS
Dica publicada em Javascript / React
Alterando a porta 3000 de um projeto em React ou NodeJS
Dica rápida de como alterar a porta padrão de um projeto em React ou NodeJS.
Quando você executa um projeto, por padrão ele é executado na porta 3000:
npm start
Compiled successfully!
You can now view Alexa Bolada in the browser.
Local: http://localhost:3000
On Your Network: http://192.168.0.100:3000
Note that the development build is not optimized.
To create a production build, use npm run build.
webpack compiled successfully
...
Para executá-lo em outra porta, basta definir a variável de ambiente PORT. Por exemplo, para executar na porta 3001:
PORT=3001 npm start
Compiled successfully!
You can now view Alexa Bolada in the browser.
Local: http://localhost:3001
On Your Network: http://192.168.0.100:3001
Note that the development build is not optimized.
To create a production build, use npm run build.
webpack compiled successfully
...
Ou, se você estiver usando o Yarn:
PORT=3001 yarn start
Para tornar a alteração permanente, basta adicionar a variável de ambiente PORT no arquivo .env:
E então executar o projeto:
npm start
Ou, se você estiver usando o Yarn:
yarn start
Por hoje é isso. Até a próxima!
Quando você executa um projeto, por padrão ele é executado na porta 3000:
npm start
Compiled successfully!
You can now view Alexa Bolada in the browser.
Local: http://localhost:3000
On Your Network: http://192.168.0.100:3000
Note that the development build is not optimized.
To create a production build, use npm run build.
webpack compiled successfully
...
Para executá-lo em outra porta, basta definir a variável de ambiente PORT. Por exemplo, para executar na porta 3001:
PORT=3001 npm start
Compiled successfully!
You can now view Alexa Bolada in the browser.
Local: http://localhost:3001
On Your Network: http://192.168.0.100:3001
Note that the development build is not optimized.
To create a production build, use npm run build.
webpack compiled successfully
...
Ou, se você estiver usando o Yarn:
PORT=3001 yarn start
Para tornar a alteração permanente, basta adicionar a variável de ambiente PORT no arquivo .env:
PORT=3001
E então executar o projeto:
npm start
Ou, se você estiver usando o Yarn:
yarn start
Por hoje é isso. Até a próxima!
Boa dica.
___________________________________________________________
Conhecimento não se Leva para o Túmulo.
https://github.com/mxnt10