Rider can't find Node that is installed with NVM

I am running Arch Linux. I have Node Version Manager (NVM) and I have Node 18.3.0 installed.

In my `.csproj` file I have the following:

<Target Name="CheckForNpm" BeforeTargets="NpmInstall">
<Exec Command="npm -v" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="You must install node and npm to build this project" />
</Target>

<Target Name="NpmInstall" BeforeTargets="ProcessCSS" Inputs="package.json" Outputs="$(NpmLastInstall) ">
<Exec Command="npm install" />
<Touch Files="$(NpmLastInstall)" AlwaysCreate="true" />
</Target>

<Target Name="ProcessCSS" BeforeTargets="Compile">
<Exec Command="npm run processcss" />
</Target>

This basically checks and ensures that `node` and `npm` are installed as these are necessary for the CSS processing.

When I try to build the project in Rider, I get the following error:

But, if I try to build the solution in my Terminal, all is good:

~/code/bejebeje.admin/src/WebUI feat/node-virtual-env-via-nvm ❯ dotnet build .
Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
  Domain -> /home/j/code/bejebeje.admin/src/Domain/bin/Debug/net6.0/bejebeje.admin.Domain.dll
  Application -> /home/j/code/bejebeje.admin/src/Application/bin/Debug/net6.0/bejebeje.admin.Application.dll
  Infrastructure -> /home/j/code/bejebeje.admin/src/Infrastructure/bin/Debug/net6.0/bejebeje.admin.Infrastructure.dll
  8.11.0
  
  > bejebeje.admin@1.0.0 processcss
  > npx tailwindcss -i ./Styles/styles.css -o ./wwwroot/css/styles.css --minify
  
  
  Done in 263ms.
  WebUI -> /home/j/code/bejebeje.admin/src/WebUI/bin/Debug/net6.0/bejebeje.admin.WebUI.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:04.45
~/code/bejebeje.admin/src/WebUI feat/node-virtual-env-via-nvm ❯    

What must I do to get Rider to work and build my solution?

5 comments
Comment actions Permalink

Hello, could you please check if there are right paths to node and npm in Preferences | Languages & Frameworks | Node.js?

0
Comment actions Permalink

Thanks for the reply Olga Diakonova.

Yes I have the right paths set up:

And here is the path from the terminal:

 

Yet the build still fails :(

0
Comment actions Permalink

Any more ideas please? I still can't run via Rider.

0
Comment actions Permalink

I also have this same issue with Node installed through Homebrew. Rider preferences are happy with node and npm paths, and in my terminal both are runnable, but when I try to build I get the error

blahblahblah.csproj(34, 5): Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE.

My Preferences show

 

0
Comment actions Permalink

I used below lines to solve the issue, run in terminal

ln -s "$(which node)" /usr/local/bin/node
ln -s "$(which rpm)" /usr/local/bin/npm
0

Please sign in to leave a comment.