Visual Studio Code and `npm install` problems on Windows?


#1

I assume (and hope) lots of you are also using Visual Studio Code on Windows:

I have this very annoying problem that when I run any npm install commands while I have Visual Studio Code open I get and error like this:

[...]
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save-dev" "@ionic/app-scripts"
npm ERR! node v7.9.0
npm ERR! npm  v4.2.0
npm ERR! path C:\Users\Jan\Documents\foo\node_modules\pbkdf2
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink

npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\Jan\Documents\foo\node_modules\pbkdf2'
npm ERR!  { Error: EPERM: operation not permitted, unlink 'C:\Users\Jan\Documents\foo\node_modules\pbkdf2'
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'C:\\Users\\Jan\\Documents\\foo\\node_modules\\pbkdf2',
npm ERR!   parent: 'ionic-hello-world' }
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:\Users\Jan\AppData\Roaming\npm-cache\_logs\2017-06-28T18_12_41_474Z-debug.log

Running as Administrator makes no difference.
When I close VS Code everything works fine.

Does anyone know about this error?
Any idea how to fix it?

Having to close Code is not really a solution…


#2

Ah, I researched this a bit and found out it actually is a bug in Visual Studio Code!

Here is the issue:

Should be fixed with the next VSCode release.

And here a npm issue where related stuff is talked about, but I am quite sure VSCode was it for me:


#3

And VSCode 1.14 was released today and seems to have fixed the issue :wink: