Search code examples
javascriptgithubnext.jsgithub-pagesvercel

Resolving "Unable to determine package manager" Error During Vercel Deployment of Next.js Project


I have developed a website using Next.js and am attempting to deploy it on Vercel. Despite following the configuration steps meticulously, I am facing an error during the deployment process. The error message reads:

""Unable to determine package manager""

I have tried modifying my Next.js configuration file to meet the specified requirements but the issue remains unresolved. My repository, containing all the code and configuration files, can be found at github link

Here are the steps I have undertaken so far:

Verified that my package.json file is present and correctly formatted.

Ensured that all dependencies are properly listed in the package.json file.

Checked the Vercel deployment settings and configuration files for any discrepancies.

Despite these attempts, the error persists. I am seeking insights or suggestions on how to resolve this issue and successfully deploy my website on Vercel.

Thank you for your assistance


Solution

  • Your issue is because the checkout action is trying to look for package-lock.json (or yarn.lock) inside portfolio_website. But it wont find it, because it's in portfolio_website/portfolio directory.

    You have two ways to solve this:

    1. Move everything in portfolio one level up (and then delete portfolio directory.

    This is the easiest way, and one I shall recommend. Since you are not using monorepos, no point putting all your files inside portfolio directory.

    1. Use the sparse-checkout feature of checkout actions:
    - uses: actions/checkout@v3
      with:
        sparse-checkout: portfolio