The configuration of external web tools is used only during assembly. The PATH variable is set (re-) using the $(ExternalToolsPath) parameter in one of the build tasks, namely: the combined semicolon in the list of external web tools.
Because you run the command in a PowerShell console window, the configuration of external web tools is not used.
My best guess is that you have several directories in the PATH environment variable that has the npm executable in it. The last catalog will always win. In this case, delete the duplicates or make sure that the directory in which the latest version of npm is added is added last. This can be done from the system properties or from the Nuget profile used in the PowerShell console window.
To check the PATH variable in PowerShell, use: Write-Host $ENV:Path
To list the possible locations of the npm executable from PowerShell, use: cmd /c where npm
source share