I’m on a Mac running node v14.7.0. When running a new install of strapi following https://strapi.io/documentation/3.0.0-beta.x/installation/cli.html, it launched on port 3000 despite server.js saying 1337, the standard port used by Strapi. Changing server.js also doesn’t change the port. I’m assuming it’s something to do with my settings outside of Strapi. Is there any other place that could be overriding the port settings for strapi?
I’m assuming you are using a Global installed Strapi, which is a different version from your local project. Because you can’t run an app with strapi dev, only with yarn strapi dev or npm run strapi dev.
Can you check the local version? yarn strapi version
and the global installed one strapi version
Personally, I would recommend investigating what exactly is overwriting your envs in your system.
But if you don’t have time right now to investigate that, just modify the port property in /config/server.js:
Thank you for your help. These are good suggestions and I’ve tried them. I think somehow the settings in my zsh env variables are overriding things. I’ll hunt down how I can unset the port in my profile environment and see if it works.
PORT=1337 strapi dev
does override, which further hints at an environment issue in my terminal profile.
We no longer recommend install the strapi package globally and instead suggest you use the built-in script within the package.json instead. So something like PORT=1337 yarn develop or PORT=1337 npm run develop. With global installed strapi you could have multiple problems in the future.
For posterity, I found the problem. I had “PORT = 3000” set in my .zshrc profile, which must have overridden the Strapi environment settings. I commented it out with a “#” , and then loaded a new terminal instance and checked that “PORT” wasn’t set using the “env” command.
I then ran “yarn strapi dev” in the strapi folder and it worked as expected, with the admin panel opening at “localhost:1337/admin”.