How To Confirm "installCommand" its working

Hello, I am trying to change the installCommand to an npm install --force at the time of deployments due to a version issue that I cannot correct and my install only works with the --force flag, when changing the installCommand key in vercel.json when I upload a deployment I still see the npm install error in the logs, is the overwrite I did in vercel.json really working? or as described it is still using npm install only. ( Working on branch stage, not on main branch for this )

{
  "builds": [
    {
      "src": "nuxt.config.js",
      "use": "@nuxtjs/vercel-builder",
      "config": {
        "installCommand": "npm install --force"
      }
    }
  ],
  "installCommand": "npm install --force"
}

Hey, Dulce! Welcome to the Vercel Community :waving_hand:

A couple of things to check:

Is your vercel.json file in the correct location?

  • Is the vercel.json file located in the root directory of your repository?
  • Have you verified that the file is being included in your git commits and pushed to the branch you’re deploying?

Are there branch-specific deployment settings overriding your configuration?

  • Have you checked if there are any branch-specific deployment overrides in your Vercel project settings?
  • Does your stage branch have different deployment configurations than your main branch?

Are project settings in the Vercel dashboard taking precedence?

  • Have you checked the Project Settings in the Vercel dashboard to see if there’s an Install Command configured there?
  • Did you previously set an Install Command through the Vercel UI that might be overriding your vercel.json configuration?
  • Have you tried clearing any Install Command settings in the Project Settings to allow your vercel.json to take effect?

Let us know how you get on!

1 Like

Thanks for your answers.

Yes, my vercel.json is located in the root directory and is included in my commits.

Regarding the second point, I don’t have different configurations for staging or main.

As for the third point, I initially overrode the installCommand from the Vercel dashboard, and when I got the same error as before, I decided to set it directly in vercel.json.

The recommended way to set this flag is using a .npmrc file, which will also ensure it installs locally for you

force=true
# or legacy-peer-deps=true

If you don’t want to commit a .npmrc we also provide an environment variable NPM_RC How do I use private dependencies with Vercel?

3 Likes

This work for me, Thanks so much! :partying_face:

1 Like

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