Search code examples
reactjsnext.jsportyarnpkg

'PORT' is not recognized as an internal or external command


When I run yarn dev It shows this following error on command prompt:

yarn run v1.22.11
$ PORT=3005 next dev
'PORT' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

My package.json is like:

"scripts": {
    "dev": "PORT=3005 next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "test": "jest"
  },

How to fix this error?

Note: I am using Windows OS.


Solution

  • I am on Windows OS:

    And fixed this using "dev": "next dev -p 3005"