Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is code fighting with npm? #28593

Closed
johnnyreilly opened this issue Jun 13, 2017 · 80 comments
Closed

Is code fighting with npm? #28593

johnnyreilly opened this issue Jun 13, 2017 · 80 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug typescript Typescript support issues
Milestone

Comments

@johnnyreilly
Copy link

  • VSCode Version: Code 1.13.0 (376c52b, 2017-06-08T16:43:13.058Z)
  • OS Version: Windows_NT ia32 10.0.10586
  • Extensions:
Extension Author Version
githistory donjayamanne 0.2.0
auto-close-tag formulahendry 0.4.2
auto-rename-tag formulahendry 0.0.12
csharp ms-vscode 1.10.0
PowerShell ms-vscode 1.3.2
vscode-sort-json richie5um2 1.9.0
vscode-icons robertohuertasm 7.9.0

Steps to Reproduce:

  1. In a node project, open up the terminal in Code.
  2. Perform an npm install
  3. Experience some variant of npm ERR! Error: EPERM: operation not permitted, rename

Close code, perform the operation in powershell / cmd. Operation succeeds.

I've only just started experiencing this in the last week or so and it's not consistent. Sometimes installs succeed. But I've experienced it on 2 separate computers, both running code and wondered if that could be the common factor...

@DickvdBrink
Copy link
Contributor

I had the same issue, for me updating to 5.0.3 (I had 5.0.0) fixed my issue.
What is your npm version?

@johnnyreilly
Copy link
Author

I tried the latest versions from 3/4/5 including 5.0.3. I'm pretty sure I received it consistently with all though (error message differed slightly but same general gist)

@yizhoucao
Copy link

same issue here after upgrade to latest 1.13.0

@ramya-rao-a ramya-rao-a added the terminal General terminal issues that don't fall under another label label Jun 13, 2017
@Tyriar
Copy link
Member

Tyriar commented Jun 13, 2017

@johnnyreilly could you install 1.12.2 and see if you have the same issue? https://az764295.vo.msecnd.net/stable/19222cdc84ce72202478ba1cec5cb557b71163de/VSCodeSetup-1.12.2.exe

@Tyriar Tyriar added the info-needed Issue requires more information from poster label Jun 13, 2017
@johnnyreilly
Copy link
Author

Sure - I'll give it a go tomorrow and report back

@johnnyreilly
Copy link
Author

Rolled back to 1.12.2 and I haven't experienced the issue again. It looks like the problem may be vs code

@johnnyreilly
Copy link
Author

As an aside, I also noticed that the "right click on taskbar / left click on recent folder" vs code launch functionality also works with 1.12.2 whereas it mostly doesn't in 1.13.0. Has that been raised elsewhere as well?

@kenoyer130
Copy link

Hi, we are a development team of 30 plus developers and this just started to happen and is killing us. Is there an ETA on a fix? Also we have had problems where the file will be corrupted and have to be manually deleted even after closing Visual Code.

The same Error: EPERM: operation not permitted, rename 'foo' -> 'foo.DELETE'

@Tyriar
Copy link
Member

Tyriar commented Jun 16, 2017

Does the regression occur with PowerShell only?

@rstropek
Copy link

I use bash with VSCode (bash on Ubuntu on Windows 10), same problem. I have to close VSCode, perform npm install, and start VSCode again. If I run npm install while VSCode is running, it fails for random packages. The error occurs with bash running in VSCode and with bash running independently.

@Tyriar
Copy link
Member

Tyriar commented Jun 16, 2017

@joaomoreno I can't think of anything I did that would cause this to regress, any related changes on your end?

@joaomoreno
Copy link
Member

joaomoreno commented Jun 16, 2017

No idea... 😕 If it's Bash for Windows, then that could be an issue

@Tyriar
Copy link
Member

Tyriar commented Jun 16, 2017

@johnnyreilly what shell are you using when you see this issue?

@kenoyer130
Copy link

@Tyriar FWIW we are using either the cmd in visual code or git bash shell. When the problem occurs if we use Unlocker it has a list of like 10-15 vscode processes locking it. Note we also tend to run 2-4 Visual code instances at the same time.

@johnnyreilly
Copy link
Author

johnnyreilly commented Jun 16, 2017

I also tend to run the same number of Vs code instances (4 or 5 - one per npm module I'm working on). I'm using powershell in the terminal.

@mauricedb
Copy link

mauricedb commented Jun 20, 2017

Running into the same issue with Code 1.13.1 on Windows 10.

Do an npm install while Code is open results in an EPERM: operation not permitted, or ENOENT: no such file or directory, rename error, close code and try again results in success.

Note: using Yarn instead of NPM seems to work just fine.

Using a PowerShell console, NPM 5.0.3 and Code 1.13.1.

@johnnyreilly
Copy link
Author

FWIW it seems having more VS Code instances running increases the likelihood of encountering the issue. Colleagues of mine that only run with 1 VS Code instance at a time haven't been bitten by this.

@mauricedb
Copy link

I was only running a single copy of VS Code when I tested this yesterday evening. It didn't fail the first time, it seems I needed to open a TypeScript file with an import of RxJS which was on one of the failing to install packages.

@johnnyreilly
Copy link
Author

johnnyreilly commented Jun 21, 2017

In case it's relevant I should say that our codebase is TypeScript also (npm modules built with ts). So we often have a good number of TypeScript files open when installing.

@WalterLeinert
Copy link

Running into the same issue with Code 1.13.1 on Windows 10.

When doing a npm install in a separate bash console (cygwin) and having vscode open on same project most of the time I'm getting EPERM errors. After closing vscode npm install works without any problem.
Tracking down the reason took me several days with many different experiments (node, npm versions, ...).

For me the issues ev. came with code 1.13, about 2 weeks ago.
Is there any way to install a previous version of vscode manually?

@Tyriar
Copy link
Member

Tyriar commented Jun 21, 2017

@rprichard could [email protected] have affected the permissions of the pty by chance? https://github.com/rprichard/winpty/releases/tag/0.4.3 There have been an increased number reports of EPERM errors since shipping it.

@WalterLeinert
Copy link

@Tyriar

  1. Where did you find the winpty 0.4.3 issues? There are no EPERM issues in the repo.
  2. For me the "npm install" issues are related to file system concurrency problems. So I see no relation to winpty.

I will do further tests with other shells.

@Tyriar
Copy link
Member

Tyriar commented Jun 21, 2017

@WalterLeinert well I was assuming it was related to permissions and since winpty is the thing that actually launches the shell process, it could be related to that.

Do people experiencing this issue have A/V software installed by chance? Medium/phantomjs#19 (comment)

@mauricedb
Copy link

@Tyriar I have Windows Defender enabled on my Windows 10 machine. I did try and turn Defender completely off but was still experiencing the same issue. No other AV software running.

@WalterLeinert
Copy link

I'm using avast and deactivating it had no effect.

@mjbvz
Copy link
Collaborator

mjbvz commented Jul 7, 2017

We're targeting early next week for 1.14. The current VSCode insiders builds match what we plan to ship with 1.14. You can test the fix using this: https://code.visualstudio.com/insiders Please let us know if you run into any issues

@WalterLeinert
Copy link

@heinrich-ulbricht I also tried to get rid of the vscode issue by deactivating avast antivirus, but this had no effect. The only way for me was switching back to vs 1.12.2 as I wrote above.
Eventually deactivating antivirus on your machine leads to different timing of something similar which leads to a slightly changed behaviour at runtime and no lock contention.

Regards, Walter

@vegarringdal
Copy link

@mjbvz fyi,
Been using the VSCode insiders build last 3 days, and no issues like before 👍

@johnnyreilly
Copy link
Author

Snap!

@dmastag
Copy link

dmastag commented Jul 12, 2017

VSCode update 1.14 seems to have resolved this

@jonsalvas
Copy link

jonsalvas commented Aug 4, 2017

Same issue with 1.14 here. Turning off antivirus software is not an option due to enterprise restrictions. Although I get "Error: EPERM: operation not permitted, scandir" it is very close to the issue above.

@einarpersson
Copy link

This appears to still be a problem for me in VSCode 1.14.2.

  1. Tried installing ava "npm install ava --save dev" in Integrated Terminal (Powershell), but failed:

2229 verbose unlock done using C:\Users\Einar\AppData\Roaming\npm-cache\_locks\staging-74d71e8b8f4dd1a0.lock for D:\Projects\cranford\node_modules\.staging 2230 verbose stack Error: EPERM: operation not permitted, scandir 'D:\Projects\cranford\node_modules\fsevents\node_modules\getpass\node_modules' 2231 verbose cwd D:\Projects\cranford 2232 verbose Windows_NT 6.1.7601 2233 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save-dev" "ava" 2234 verbose node v8.2.0 2235 verbose npm v5.3.0 2236 error path D:\Projects\cranford\node_modules\fsevents\node_modules\getpass\node_modules 2237 error code EPERM 2238 error errno -4048 2239 error syscall scandir 2240 error Error: EPERM: operation not permitted, scandir 'D:\Projects\cranford\node_modules\fsevents\node_modules\getpass\node_modules' 2240 error { Error: EPERM: operation not permitted, scandir 'D:\Projects\cranford\node_modules\fsevents\node_modules\getpass\node_modules' 2240 error stack: 'Error: EPERM: operation not permitted, scandir \'D:\\Projects\\cranford\\node_modules\\fsevents\\node_modules\\getpass\\node_modules\'', 2240 error errno: -4048, 2240 error code: 'EPERM', 2240 error syscall: 'scandir', 2240 error path: 'D:\\Projects\\cranford\\node_modules\\fsevents\\node_modules\\getpass\\node_modules' } 2241 error Please try running this command again as root/Administrator. 2242 verbose exit [ -4048, true ]

  1. Opened up Powershell as administrator in a second terminal (outside VSCode) but got the same error.

  2. Finally, closed VSCode and tried again in the separate Powershell window - and this time it worked!

@rubenprins
Copy link

rubenprins commented Aug 10, 2017

Same here, "Error: EPERM: operation not permitted, scandir" for any npm install that's non-trivial (whether run from the integrated terminal or outside, no difference). Closing VSCode always solves this.

VSCode 1.14.2.

@filipesilva
Copy link

I don't think it's any directory. It's a specific module that I get this on myself: \node_modules\fsevents. It's ALWAYS fsevents. And it's always the scandir operation.

I'm using Windows, and so is @einarpersson. And on Windows, fsevents is optional. So I bet it's related to that. Something about the module being optional is tripping up VSCode. Maybe on optional modules the dir is created and torn down super fast.

@einarpersson
Copy link

Yep @filipesilva, now that you mention it, I also have noticed that it fsevents seems to be mentioned in the error message every time.

@filipesilva
Copy link

@mjbvz does optional modules causing problems ring any bells perhaps?

@jonsalvas
Copy link

jonsalvas commented Aug 11, 2017

ok FYI: Still got the same issue with 1.15 and indeed it is always referring to \node_modules\fsevents\node_modules\getpass\node_modules. Strange thing is, it is occuring randomly, sometimes the first time, sometimes after 3 times executing an npm install. It is really annoying because I have to close the terminal every 10 mins.

@ccarse
Copy link

ccarse commented Aug 21, 2017

I'm also having this problem, usually with the fsevents package. I am also running anti virus that I cannot disable. I'm running 1.15.1

@ccarse
Copy link

ccarse commented Aug 21, 2017

@mjbvz Should we open new issues for people who are still experiencing this issue? Or should this issue be reopened?

@filipesilva
Copy link

There's an issue on npm for the same thing: npm/npm#17671

Perhaps the new problem is not related to VSCode directly.

@ccarse
Copy link

ccarse commented Aug 21, 2017

You know I think you're right. Usually closing code fixes this issue but it's still happening for me now even when code's not running. Thanks!

@DickvdBrink
Copy link
Contributor

Had the same issue indeed without VSCode, but I did have Visual Studio 2017 open which was running a TSServer. Still might not be related though, but I don't think it is VSCode it's fault.

@twastvedt
Copy link

For me this is still an issue. I am able to install just fine after closing VSCode so it does seem to be an issue with VSCode and not npm.

@einarpersson
Copy link

Downgrading to npm version 5.0.4 seems to have solved the problem for me
(npm install -g [email protected])

@filipesilva: Yes, it seems to be a more general problem of npm not being happy with many processes working on the same files. npm/npm#17671 That would explain why the problem arises when you're working in the same folder in vscode, perhaps?

@filipesilva
Copy link

To be perfectly honest I don't think it's related to VSCode at all. I think that it's the combo of:

  • people reporting the problem use VSCode on npm projects.
  • the second install always works, regardless of having VSCode open or not.

@einarpersson
Copy link

Well, even if the root cause isn't VSCode there still seems to be a correlation. I can at least on my part say that I've had a lot of problems installing npm packages while in the VSCode terminal but not as much as when I've closed VSCode. And the second install does not always work for me. But it's not a 1-1 causation and reading from the other thread I would agree that the problem seems to has it root somewhere else.

In any case, downgrading npm seems to work 100% for now for me at least. How about you?

@filipesilva
Copy link

I didn't try downgrading because I had a bunch of problems with older 5.x versions... I tried upgrading to 5.4 and ran into npm/npm#18287.

There's a report of using --no-optional to fix these issues as well in #17671 (see my comment npm/npm#17671 (comment) and the commit right above it).

@electrotype
Copy link

What I find strange about all those new comments saying that it may not be an issue with VSCode but with npm itself, is that I downgraded and sticked with VSCode 1.12.2 (as suggested here) since this issue appeared and never experienced it again...

@rubenprins
Copy link

@filipesilva The problem does not always go away if you install a second time. This works only some of the times. In fact: if this problem happens, I can only rarely resolve the error by running npm install again.

Closing VSCode does always solve the problem, however (for me, at least), and I've only once seen the problem without VSCode running.

So to me, current VSCode versions at the very least cause the bug to surface, while older versions of VSCode do not, regardless of where in the source code or in which program the bug actually resides.

@filipesilva
Copy link

My bad, my recollection was that I always reinstalled a second time and it seemed to be fine.

@shaunpitt
Copy link

I'm having the same issue here. Win 10 and VS Code 1.15.1 64-bit. Tried running as Administrator same issues.
Running Terminal in VSCode
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" "gulp"
npm ERR! node v6.10.3
npm ERR! npm v3.10.10
npm ERR! file C:\Users\ShaunPitt\package.json
npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! No data, empty input at 1:1
npm ERR!
npm ERR! ^
npm ERR! File: C:\Users\xxxxxxxx\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\xxxxx\some-folder\npm-debug.log

And running PowerShell while VSCode still open:

PS C:\WINDOWS\system32> npm install gulp
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon
as possible. Use 'npm ls graceful-fs' to find it in the tree.
C:\WINDOWS\system32
`-- [email protected]

npm WARN enoent ENOENT: no such file or directory, open 'C:\WINDOWS\system32\package.json'
npm WARN system32 No description
npm WARN system32 No repository field.
npm WARN system32 No README data
npm WARN system32 No license field.

This is really a struggle. I think i will go back to 1.12 as it seems the best right now.

Shaun

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug typescript Typescript support issues
Projects
None yet
Development

No branches or pull requests