This is common error on NuttX, but unfortunately the build system is not clear to explain to the user about it.

$ git clone https://github.com/apache/incubator-nuttx
$ cd incubator-nuttx
$ ./tools/configure.sh esp32-core:nsh
...
This program built for x86_64-pc-linux-gnu
Report bugs to [email protected]
make: *** [tools/Makefile.unix:319: dirlinks] Error 2
ERROR: failed to refresh

This problem happens because you missed to clone the apps/ repository:

$ cd ..
$ git clone https://github.com/apache/incubator-nuttx-apps apps

Now you can configure it correctly:

$ cd incubator-nuttx
$ ./tools/configure.sh esp32-core:nsh
...
#
# configuration written to .config
#