# Recast navmesh navigation with react

**URL:** <https://forum.babylonjs.com/t/recast-navmesh-navigation-with-react/33847>\
**Category:** Questions\
**Created:** [September 11, 2022, 9:44pm UTC](https://forum.babylonjs.com/t/recast-navmesh-navigation-with-react/33847 "2022-09-11T21:44:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JaChadwell](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jachadwell/32/26436_2.png) [@JaChadwell](https://forum.babylonjs.com/u/JaChadwell)\
**Post date:** [September 11, 2022, 9:44pm UTC](https://forum.babylonjs.com/t/recast-navmesh-navigation-with-react/33847/1 "2022-09-11T21:44:53Z")

</div>

Hi

I am creating a scene where I want the player to go where I click and I have achieved that in the playground below using a navmesh because eventually I’ll need the player to walk up and down stairs, hills, etc.

> **[Babylon.js Playground](https://playground.babylonjs.com/#3EF8TZ%233)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

I’ve read multiple forums on getting recast-detour to work using npm but haven’t been successful in getting it to work myself. I was hoping there had been some updates or a simple way to get recast-detour working with react. I would like to continue using navmeshes for dynamic x, y, and z player movement in the environment but if there is a different way to achieve this without a navmesh I am open to trying it instead. The error I’m getting with react is below:

```auto
ERROR in ./node_modules/recast-detour/recast.js 268:26-49

Module not found: Error: Can't resolve 'path' in 'C:\Users\Jared\Desktop\my-app\node_modules\recast-detour'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
	- install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "path": false }

ERROR in ./node_modules/recast-detour/recast.js 280:30-43

Module not found: Error: Can't resolve 'fs' in 'C:\Users\Jared\Desktop\my-app\node_modules\recast-detour'

```

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [September 12, 2022, 8:18am UTC](https://forum.babylonjs.com/t/recast-navmesh-navigation-with-react/33847/2 "2022-09-12T08:18:50Z")

</div>

I’ve never seen this error message before. Do you have any idea @RaananW ?

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [September 12, 2022, 8:40am UTC](https://forum.babylonjs.com/t/recast-navmesh-navigation-with-react/33847/3 "2022-09-12T08:40:30Z")

</div>

that’s interesting. It seems like the recast-detour module is referencing `path`?

will need to check how it is built and why the path reference is needed.

---

<div class="post-metadata">

**Author:** ![JaChadwell](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jachadwell/32/26436_2.png) [@JaChadwell](https://forum.babylonjs.com/u/JaChadwell)\
**Post date:** [September 12, 2022, 8:31pm UTC](https://forum.babylonjs.com/t/recast-navmesh-navigation-with-react/33847/4 "2022-09-12T20:31:57Z")

</div>

@RaananW  
Just for an update, I was able to fix the path error by running npm install path but I’m still getting this part of the error.

```auto
Module not found: Error: Can't resolve 'fs' in 'C:\Users\Jared\Desktop\my-app\node_modules\recast-detour'

```

---

<div class="post-metadata">

**Author:** ![JaChadwell](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jachadwell/32/26436_2.png) [@JaChadwell](https://forum.babylonjs.com/u/JaChadwell)\
**Post date:** [September 12, 2022, 9:17pm UTC](https://forum.babylonjs.com/t/recast-navmesh-navigation-with-react/33847/5 "2022-09-12T21:17:45Z")

</div>

Was able to get rid of the fs error by altering the package.json file in /node\_modules/recast-detour by adding

```auto
"browser": {
    "fs": false
  },

```

Recast now working with react. Hope this helps you guys and anyone in the future!
