This content originally appeared on DEV Community and was authored by Surjoyday Talukdar
I recommend following the steps below, as suggested by timneutkens in the Next.js GitHub issue #8945. Installing Next.js globally can cause multiple issues when deploying to production.
Steps to Fix:
In your terminal type:
nano ~/.zshrc
Scroll to the very end of the .zshrc file and add the following lines to include the locally installed node_modules/.bin directory in your PATH:
export PATH="./node_modules/.bin:$PATH"
Save and exit the file:
- Press CTRL + X to exit.
- Press Y to confirm saving.
- Press Enter to save the changes.
- Apply the changes by running:
source ~/.zshrc
This ensures that your locally installed dependencies are prioritized without requiring a global installation of Next.js.
This content originally appeared on DEV Community and was authored by Surjoyday Talukdar