I recently installed Node.js and Angular on my machine for some explorations. During the creation of my first test app using the Angular CLI I came across an annoying issue.
I wanted to create a new project using the command
ng new my-demo-app
The following error occured:
30969 verbose unlock done using C:\Users\testuser\AppData\Roaming\npm-cache\_locks\staging-9ee6130cb5906a84.lock for D:\angular\my-demo-app\node_modules\.staging
30970 verbose stack Error: EPERM: operation not permitted, scandir 'd:\angular\my-demo-app\node_modules\fsevents\node_modules\getpass\node_modules'
30971 verbose cwd D:\angular\my-demo-app
30972 verbose Windows_NT 6.1.7601
30973 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "--quiet" "install"
30974 verbose node v8.9.1
30975 verbose npm v5.5.1
30976 error path D:\angular\my-demo-app\node_modules\fsevents\node_modules\getpass\node_modules
30977 error code EPERM
30978 error errno -4048
30979 error syscall scandir
30980 error Error: EPERM: operation not permitted, scandir 'D:\angular\my-demo-app\node_modules\fsevents\node_modules\getpass\node_modules'
30980 error { Error: EPERM: operation not permitted, scandir 'D:\angular\my-demo-app\node_modules\fsevents\node_modules\getpass\node_modules'
30980 error stack: 'Error: EPERM: operation not permitted, scandir \'D:\\angular\\my-demo-app\\node_modules\\fsevents\\node_modules\\getpass\\node_modules\'',
30980 error errno: -4048,
30980 error code: 'EPERM',
30980 error syscall: 'scandir',
30980 error path: 'D:\\angular\\my-demo-app\\node_modules\\fsevents\\node_modules\\getpass\\node_modules' }
30981 error Please try running this command again as root/Administrator.
30982 verbose exit [ -4048, true ]
Error -4048 seems to occur a lot and most of the time it is a permission issue. I first thought it has to do with some access issue of my user but after lot's of googling and trial and error I found an helpful hint in this forum:
https://groups.google.com/forum/#!topic/angular/0iFLX6dEdeA
User norricorp gave a hint that this could be related to windows search indexing. During the app-creation files and folders are newly created and then moved to other places. Windows indexing can interrupt this process as it keeps files to be (re-)moved open , so the whole process does not work properly.
Once I disabled the windows indexing service the command worked properly :-)