Spotless styling task failed on my local environment

Hi
OS: Ubuntu 22.04 LTS, 64-bit, gnome version - 42.2

I am trying to build locally with intellij idea, but gradle tasks failed:

spotless
...
    format 'styling', {
        target createSpotlessTarget(['**/*.yaml', '**/*.json'])

        prettier()
    }

error log:


* Exception is:
com.intellij.openapi.externalSystem.model.ExternalSystemException: Could not create task ':spotlessStylingApply'.
Could not create task ':spotlessStyling'.
Can't automatically determine npm executable and none was specifically supplied!

Spotless tries to find your npm executable automatically. It looks for npm in the following places:
- An executable referenced by the java system property 'npm.exec' - if such a system property exists.
- The environment variable 'NVM_BIN' - if such an environment variable exists.
- The environment variable 'NVM_SYMLINK' - if such an environment variable exists.
- The environment variable 'NODE_PATH' - if such an environment variable exists.
- In your 'PATH' environment variable

If autodiscovery fails for your system, try to set one of the environment variables correctly or
try setting the system property 'npm.exec' in the build process to override autodiscovery.
	at org.jetbrains.plugins.gradle.model.ProjectImportAction.addBuildModels(ProjectImportAction.java:388)

Hello @kananindzya, could you try these steps:

  1. File → Invalidate caches / Restart

  2. Shutdown Intellij Idea

  3. Remove .gradle folder in the user home directory

  4. Restart Intellij Idea let it download all the Gradle packages