rmdir : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

Problem

Project folder contains node_modules directory. When deleting the project folder in PowerShell line[$: rmdir projectname], the Remove-Item command raises an error: "rmdir : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters."

Solution

I found two, one node based rimraf and the other a command line solution.

Command Line

$: RD \s projectname

Node Solution

Look into project rimraf.