ng new -4048 error

893 views
Skip to first unread message

norricorp

unread,
Mar 21, 2017, 3:55:40 AM3/21/17
to Angular and AngularJS discussion
Hi,
not sure what event has caused this but in the last few days my angular 2 installation on windows has gone badly wrong.
As an example running ng new proj-name gives the following (only last lines shown)

(node:7180) Warning: Possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsev...@1.1.1
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\jnorris\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.7
npm ERR! path C:\Temp\angularjs_example\angular2\heroes2\node_modules\.staging\@angular\core-e9954ff8
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\.staging\@angular\core-e9954ff8' -> 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\@angular\core'
npm ERR!     at destStatted (C:\Users\jnorris\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:25:7)
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\.staging\@angular\core-e9954ff8' -> 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\@angular\core'
npm ERR!     at Error (native)
npm ERR!  { Error: EPERM: operation not permitted, rename 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\.staging\@angular\core-e9954ff8' -> 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\@angular\core'
npm ERR!     at destStatted (C:\Users\jnorris\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:25:7)
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\.staging\@angular\core-e9954ff8' -> 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\@angular\core'
npm ERR!     at Error (native) parent: 'heroes2' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR!     C:\Temp\angularjs_example\angular2\heroes2\npm-debug.log
Package install failed, see above.

Running in an administrator window makes no difference. I did see something that said I needed to change permissions at C:\Users\jnorris\AppData\Roaming\npm. This folder was read only and I changed that. But still same problem.

ng --version
@angular/cli: 1.0.0-beta.32.3
node: 6.9.5
os: win32 x64

Does anyone know what has caused this and what can fix it?

Regards,
John

Sander Elias

unread,
Mar 21, 2017, 5:39:22 AM3/21/17
to Angular and AngularJS discussion
Hi John,

Probably some of your dependencies are mixed up.  Just remove both global and local installation, and move to the latest RC.

Regards
Sander

norricorp

unread,
Mar 21, 2017, 6:11:52 AM3/21/17
to Angular and AngularJS discussion
Hi Sander,
followed the instructions - uninstalled global, installed global latest, installed in existing project having removed node_modules and exactly the same result.
At end of  npm install --save-dev @angular/cli@latest, I got the same EPERM -4048 error.
Same result if I run in administrator console.
I seem to have some serious corruption here - any other ideas?

norricorp

unread,
Mar 21, 2017, 1:04:41 PM3/21/17
to Angular and AngularJS discussion
Just to add, if I create a new project, I get exactly the same problem. Interestingly the command tries to rename files it has already created in the new projects node_modules folder eg
 
 npm ERR! Error: EPERM: operation not permitted, rename 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\.staging\rxjs-67f86bc0' -> 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\rxjs'

npm ERR!     at destStatted (C:\Users\jnorris\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:25:7)
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)

So it is moving a temp rxjs folder from .staging to node_modules. And either does not have permission to delete or write.

I have upgraded angular2 before and had troubles then with existing projects but could create new projects. Now it will not even create new projects. And this is windows so permissions do not really come into it.

norricorp

unread,
Mar 22, 2017, 4:20:03 AM3/22/17
to Angular and AngularJS discussion
EPERM: operation not permitted, rename 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\.staging\rxjs-67f86bc0' -> 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\rxjs'

 So I did this manually in file explorer - moved the rxjs-67f86bc0 folder into node_modules. And it failed saying that a file in this folder was already opened by another process. Then tried it a few minutes later and it worked. So something has files in .staging open and that is preventing move / rename.

Does anyone have any ideas what this might me?

Sander Elias

unread,
Mar 22, 2017, 4:40:13 AM3/22/17
to Angular and AngularJS discussion
Hi John,

It sounds like your machine has user permission issues. You might want to reset all on your drive. (if its under admin, you might need to get a sysadmin to fix this for you.)
(there is information enough on how to do this on the internet, but make sure you know what you are doing, as messing it up even further might make your machine unworkable!)

Regards
Sander

norricorp

unread,
Mar 22, 2017, 4:44:47 AM3/22/17
to Angular and AngularJS discussion
So from what I can see the folder is being kept open by Search Protocol Host.
A few weeks back I included my angular folders in the indexing options for search. It then created the index which took a few hours. And I thought that would be it. But what I *think* is happening is that when new things are created in that top level folder such as upgrading angular or creating new projects, search then starts to index them and so breaks angular when it moves temporary folders to their final position.
I have switched off indexing for that area and will see what the result is.

norricorp

unread,
Mar 22, 2017, 4:49:51 AM3/22/17
to Angular and AngularJS discussion
And now it works .....


Grand Mozeur

unread,
Apr 5, 2017, 9:20:11 AM4/5/17
to Angular and AngularJS discussion
Best answer ever ! Thanks bro, this buggy spend me half a day...
Just ending this process works for me.

Sander Elias

unread,
Apr 6, 2017, 8:29:42 AM4/6/17
to Angular and AngularJS discussion
Oh, I didn't think of this! thanks for letting us know. I'm sure it helps others.

(the search indexing gives more issues similar to this. All developers I know have this turned off or at least excluded his source folders. It's one of those basic things you do when setting up a new system.Sorry I didn't think of this!)

Regards
Sander

mrizi...@gmail.com

unread,
Oct 24, 2017, 10:47:53 AM10/24/17
to Angular and AngularJS discussion
Thnks, I had the same error and it works for me.
Reply all
Reply to author
Forward
0 new messages