# JS Build Error on Build - node modules not found

**URL:** <https://discourse.gohugo.io/t/js-build-error-on-build-node-modules-not-found/50510>\
**Category:** support\
**Created:** [July 1, 2024, 3:59pm UTC](https://discourse.gohugo.io/t/js-build-error-on-build-node-modules-not-found/50510 "2024-07-01T15:59:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ricardoom](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ricardoom/32/12514_2.png) [@ricardoom](https://discourse.gohugo.io/u/ricardoom)\
**Post date:** [July 1, 2024, 3:59pm UTC](https://discourse.gohugo.io/t/js-build-error-on-build-node-modules-not-found/50510/1 "2024-07-01T15:59:30Z")

</div>

After getting the most recent upgrade, am encountering this error:

`ERROR JSBUILD: failed to transform "/js/main.js" (text/javascript): Could not resolve "@cloudinary/url-gen" Built in 1557 ms Error: error building site: JSBUILD: failed to transform "/js/main.js" (text/javascript): Could not resolve "@cloudinary/url-gen"`

So in my triaging this issue, if I disable the offending node\_module, (@cloudinary/url-gen), Hugo will continue to build etc. So it seems like a matter of the module not being found, but therein lies the rub, as it were. If I nuke the entire `node_modules` folder and then run `npm i` again; no joy. I thought maybe it had something to do w/ the cloudinary module, so I tried a different module from npm just to see, and got the same build error.

I should add this was working on the previous version of Hugo. If I write JS with no module imports from the `node_modules` the project will build and everything works as expected…

So it seems that for some reason js.Build is not able to find the node modules directory. See below for my file structure:

```auto
├─ archetypes
├─ content
├─ data
├─ layouts
├─ node_modules
       ├─ @cloudinary
├── public
├── resources
├── sandbox
├── static
└── themes
          └─ blank
                 ├─ archetypes
                 ├─ assets
                 ├── js
                     │
                   utils.js
                   mobileNav.js 
                 ├─ ...

```

`Node Version: 16.14.2`  
`hugo v0.128.0+extended darwin/amd64 BuildDate=2024-06-25T16:15:48Z VendorInfo=brew`

Not sure where to go from here, perhaps a config file is order, to explicitly direct js.Build to node modules?

Thanks

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [July 1, 2024, 6:49pm UTC](https://discourse.gohugo.io/t/js-build-error-on-build-node-modules-not-found/50510/2 "2024-07-01T18:49:15Z")

</div>

> [@ricardoom](#):
>
> Not sure where to go from here, perhaps a config file is order, to explicitly direct js.Build to node modules?

Without seeing/trying the source, I don’t think it’s possible to guess what your problem may be.

---

<div class="post-metadata">

**Author:** ![ricardoom](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ricardoom/32/12514_2.png) [@ricardoom](https://discourse.gohugo.io/u/ricardoom)\
**Post date:** [July 1, 2024, 7:19pm UTC](https://discourse.gohugo.io/t/js-build-error-on-build-node-modules-not-found/50510/3 "2024-07-01T19:19:57Z")

</div>

@bep, roger that, here’s the repo / branch I’m working on. Dont judge me too harshly. 🤣

> **[GitHub - ricardoom/dominotrono at content/add-artwork](https://github.com/ricardoom/dominotrono/tree/content/add-artwork)**
>
> content/add-artwork

As, always I am grateful for any insight and assistance!

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [July 1, 2024, 7:44pm UTC](https://discourse.gohugo.io/t/js-build-error-on-build-node-modules-not-found/50510/4 "2024-07-01T19:44:53Z")

</div>

> [@ricardoom](#):
>
> @bep, roger that, here’s the repo / branch I’m working on. Dont judge me too harshly. 🤣
> 
> [GitHub - ricardoom/dominotrono at content/add-artwork](https://github.com/ricardoom/dominotrono/tree/content/add-artwork)

So, it builds fine on my MacBook:

```auto
v16.20.0
hugo v0.129.0-DEV-932ab4c058bf7a36e55d0f607b5a237f90a25405+extended darwin/arm64 BuildDate=2024-06-27T21:35:56Z

```

I did a fresh clone and then

```auto
npm i
hugo server

```

Checked the site and it seems to be working fine.

So, this is why I’m not a big fan of the NPM eco system and try to avoid it when I can. I have had NPM projects that stopped working for no obvious reason myself.

Are you sure that downgrading Hugo makes this somehow work for you?

---

<div class="post-metadata">

**Author:** ![ricardoom](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ricardoom/32/12514_2.png) [@ricardoom](https://discourse.gohugo.io/u/ricardoom)\
**Post date:** [July 1, 2024, 7:53pm UTC](https://discourse.gohugo.io/t/js-build-error-on-build-node-modules-not-found/50510/5 "2024-07-01T19:53:15Z")

</div>

Ah. I wasnt aware I was behind a version of gohugo. Brew has been giving me hard time lately, I’ll spare you the details, but when I run `brew upgrade hugo` its yelling back: _ **Warning:** hugo 0.128.0 already installed_

I’ll dig into why Brew is not installing the latest… Could be OS related, not sure. I’m traveling atm and am not working on my primary computer.

Thank you much sir!

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [July 1, 2024, 8:05pm UTC](https://discourse.gohugo.io/t/js-build-error-on-build-node-modules-not-found/50510/6 "2024-07-01T20:05:10Z")

</div>

> [@ricardoom](#):
>
> Ah. I wasnt aware I was behind a version of gohugo. B

oh well, v0.128.0 is the latest. It shows v0129.0-DEV above because I build from source, but it’s the v0.128.0 source …

---

<div class="post-metadata">

**Author:** ![ricardoom](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ricardoom/32/12514_2.png) [@ricardoom](https://discourse.gohugo.io/u/ricardoom)\
**Post date:** [July 1, 2024, 8:30pm UTC](https://discourse.gohugo.io/t/js-build-error-on-build-node-modules-not-found/50510/7 "2024-07-01T20:30:05Z")

</div>

Well, some kind of very bespoke issue on my end (I’m looking at you Node!)  
Not sure how to close this without “solving”…  
regardless. thanks!

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [July 2, 2024, 10:34am UTC](https://discourse.gohugo.io/t/js-build-error-on-build-node-modules-not-found/50510/8 "2024-07-02T10:34:17Z")

</div>

> [@ricardoom](#):
>
> Not sure how to close this without “solving”…

Just leave it open … Maybe others can chime in with some “I experienced the same thing and what I did was …”
