Home
Support Forums

How to go from the old Build command "npm run build" to "hugo version"?

Hi,
I made a website a couple of years ago with an old hugo versione and an old theme and now I can see many sirus alerts on my github about the software I’m using. So I decided to update the hugo and theme version but all the guides and docs that I can find in your documentation, show me a situation in wich I “simply” need to change the version of HUGO in “Site Settings” → Build & Deply
Base directory HUGO VERSION
with a Build command hugo
but I have:
Build command: npm run build
so how may I change from “npm run build” to the new HUGO version?
Best regards
Thank you
Igor

Hi @igorguida,

If you need to use a newer version of Hugo, you need to follow this:

But your question seems to be different than what you’re actually trying to do. If you can share your repo, that might help.

Thank you, this is my repository:

This is my website hosted via Netlify:

The link that you gave me:
docs.netlify.com

has a different situation compared with mine that you can see here:

in the field: Build command I have: “npm run build” not “hugo”

So I can’t understand what I need to do.
Thank you
Best regards

Hi @igorguida

As per the documentation @hrishikesh provided, you need to set the HUGO_VERSION environment variable to specify which hugo version you wish to use. You can add this to the netlify.toml file in your repository under [build.environment] where you have already defined other variables.

You do not need to change your build command. npm run build will run the build script from the package.json in your repository which in turn runs hugo.