Rider does not recoginise function after run "npm install"
HI,
I am running JetBrains Rider 2024.1.4. Rider night colour theme, I am trying to create a web api project + React project (by vite).
1 Create WebApi with .net 6 sdk from Rider.
2 cd to the project folder, and run “npm create vite@latest”.
3 Open the App.tsx, you can see the useState was showing Green colour as it is a React hook function.
4 Follow the vite instruction, cd into the Client project and run npm install to install all the dependencies.
5 After that, the useState does not show green colour any more, when i mouse hover over it, it is still showing it is function.
I wonder if this is a bug after the npm install, the rider colour them fail to regonise the react hook function somehow ?



Please sign in to leave a comment.
Hello,
Thank you for contacting Rider support.
Unfortunately I couldn't reproduce this issue. For me, the code is half-red (in .tsx) after
npm create vite@latest
. And then, afternpm install
it becomes fully resolved.Does reopening a project solves the issue by chance? If reopening project doesn't help, please try File | Invalidate Caches. If invalidating caches doesn't help, ould you mind sharing the resulting project you are getting after invoking these commands? Please upload it to the Upload service and let me know the upload ID. (or share a project on Git)
Have a nice day!
Hi Dmitry Kazantsev , thanks for the response, i tried clear cache, reopen the open, reload the projet, it still not working for me. And i have uploaded project file to 2024_07_04_dq2mzQz9kJDCJuRAtuyRev. And i am using Mac operation system by the way.
Cheers
Hello,
Thank you for sharing your project. It is weird, the issue doesn't reproduce for me in my environment with your project.
Would you mind trying to reinstall npm and recreating a project?
brew uninstall npm
;brew install npm
;Do not forget to disable trace scenario enabled.
Have a nice day!
HI Dmitry Kazantsev ,
I uninstall and install the node ,it does not resolve the issue. I think my rider can detect the Node interpreter and package manage, so this is not the issue. I have uploaded the log to 2024_07_06_AE9fBtGWch9y4TdfRon92D.
But i do noticed, if i open the whole project from the top folder this issue occured, but if i just open the “Client” folder which is the react project, it works fine. See the screen shot below. Do you think somehow rider fail to recognise some of the node lib when i open a C# project which contains frontend project in this case react. Need some reference to tell rider ?
Hello,
From your recent screenshot it is seen, that the Client folder is not indexed. Please try right-clicking on it and select Tools | Start Index. Or ensure the Client folder is under {SolutionFolder}/{ProjectFolder}/ path.
Please let me know if that helps and whether the code become resolved.
Have a nice day!
Hi Dmitry Kazantsev
I dont think it is Index issue, as we never index node_moduels, that is like index the external library. But i finally resolve the issue by diff solution. I right click the “Client” project → tools → Attach Solution. Then rider resolve all the issue for me. And i saw a similar folder was shown at the bottom of solution mark as “Attached”, i click the folder select unattach solution. Everything still working fine for me, No new file generated what so ever. So I think because the client project was created via a command line, so rider does not recoginise it, need mannually to do this attach and unattach to resolve it.
Anyway,Thank you for your help.
Thank you for the details shared. I am glad to know you have found a solution.
After taking another look at the issue, I noticed that you disabled bulk of bundled plugins. I reproduced the same behavior by disabling Angular or Vue.js plugin.
I suppose you can reproduce the same issue by recreating a project (so your workaround only works for the project where you applied it).
The proper solution is to enable back these two plugins from Rider settings.
I am yet to know, why disabling these plugins bring such a behavior. Should I have any news, I'll let you know.
Have a nice day!
HI Dmitry Kazantsev ,
Thank you for the response. Yes, if i enable both Vue.js and Angular plugin , the issue will no long exist when i create a new project. I disable some of the bundled plugins as i think my current project does not need it, less the enabled plugin will bring a better IDE performance i think, Not sure why we need Angular and vue plugin for React project. :D
Cheers
Hello,
I am glad to know that we found a root cause of the issue and a solution for it. I reported this issue to our tracker: RIDER-114700 node_modules isn't indexed if Angular or Vue.js bundled plugin is disabled. We would appreciate it if you could upvote it to demonstrate your interest.
If there is anything else I can assist you with, please tell me.
Have a nice day!