Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix 'rimraf is not a recognized command' in Windows 10

After creating the .NET Core / React & Redux project template and attempting to start the application, the react compile crashes with rimraf not recognized.

This is on Windows 10, node.js version 10.15.3. I have tried uninstalling/installing node.js multiple times and running multiple different npm commands. It seems like powershell is incorrectly linking to rimraf for some reason.

npm echo %PATH% provides the correct path to the ./node_modules/.bin directory. And running that path followed by e.g. /rimraf works properly. The command in package.json is "start": "rimraf ./build && react-scripts start".

like image 665
Sean Becker Avatar asked Jul 10 '19 17:07

Sean Becker


People also ask

Does rimraf work on Windows?

You can install rimraf globally using npm . It's a common module, so you can install it on any operating system that supports npm . Windows, Linux, macOS - you shouldn't have any issues here.

What is rimraf NPM?

rimraf is an executable that is used to clean the installed node packages in a node based project. It basically executes the rm -rf command on the node_modules directory, but is a faster alternative.


2 Answers

I had to manually run npm install to make it work.

open command line (e.g. from Visual Studio: Tools -> Command Line -> Developer Command Prompt)

go to ClientApp (cd ClientApp) folder of your project and type:

npm install
like image 79
antonpv Avatar answered Oct 17 '22 02:10

antonpv


I finally got rid of this error by installing rimraf globally

npm install rimraf -g

like image 25
alban maillere Avatar answered Oct 17 '22 03:10

alban maillere