Running into command not found with a Next JS app

I am probably doing something stupid here. I have a web service which is a Next app and I keep running into this
“next: command not found”

I can see Next in my package.json and I have “npm install; npm run build” in my “Build Command” section. The “Start Command” is “next start” and that’s where it fails.

Hi there,

There could be a couple of reasons for this issue that I know of:

  • You have set NODE_ENV to production and you only have next as a dependency in your devDependecies . npm doesn’t install devDependcies when NODE_ENV is production.
  • You are using a monorepo and have set the root directory setting to a subdirectory of your Git repo. Unfortunately when you do this, <monorepo-root>/node_modules/.bin doesn’t get added to the PATH so the commands installed here can’t be found. You will need to run next with the correct path, which is ./node_modules/.bin/next

If neither of the above issues apply, please let us know.


Render Support, UTC+10 :australia:

1 Like

Thank you for the response. I figured out the problem. I changed the start command to npm run start and it worked.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.