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

NPM Install - Rename Error #2097

Closed
sgtoj opened this issue May 13, 2017 · 87 comments
Closed

NPM Install - Rename Error #2097

sgtoj opened this issue May 13, 2017 · 87 comments

Comments

@sgtoj
Copy link

sgtoj commented May 13, 2017

Windows Build

Microsoft Windows [Version 10.0.16193.1001]

Cause

Running npm install against a package.json and/or a single install (typescript or tslint).

Problem

TL;DR: Appears that #14 issue has returned.

On two different computers with the same build, npm has fails to installed packages due npm not able to moving it from node_modules/.staging/ to node_modules/. It's not limited to specific module. The real catch is, if I reboot the system and try again, the issue is resolved. In the last build, when this happen I would closed all editor windows and kill any running conhost, cmd, and bash process then retry with mostly success. Now the issue see to be more frequent and system must be rebooted to resolve.

NPM Error Example

brian@PC-Main:/mnt/c/Users/Brian/OneDrive/Development/GitHub/testdouble.js$ npm install tslint --save-dev
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! path /mnt/c/Users/Brian/OneDrive/Development/GitHub/testdouble.js/node_modules/.staging/tslint-07584f89
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall rename
npm ERR! Error: EACCES: permission denied, rename '/mnt/c/Users/Brian/OneDrive/Development/GitHub/testdouble.js/node_modules/.staging/tslint-07584f89' -> '/mnt/c/Users/Brian/OneDrive/Development/GitHub/testdouble.js/node_module
s/tslint'
npm ERR!  { Error: EACCES: permission denied, rename '/mnt/c/Users/Brian/OneDrive/Development/GitHub/testdouble.js/node_modules/.staging/tslint-07584f89' -> '/mnt/c/Users/Brian/OneDrive/Development/GitHub/testdouble.js/node_mod
ules/tslint'
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'rename',
npm ERR!   path: '/mnt/c/Users/Brian/OneDrive/Development/GitHub/testdouble.js/node_modules/.staging/tslint-07584f89',
npm ERR!   dest: '/mnt/c/Users/Brian/OneDrive/Development/GitHub/testdouble.js/node_modules/tslint',
npm ERR!   parent: 'testdouble' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/brian/.npm/_logs/2017-05-13T00_55_06_467Z-debug.log

Strace

4.6k Line Trace

@sgtoj sgtoj changed the title NPM NPM Install - Rename Error May 13, 2017
@thorsteneb
Copy link

@russalex Take a look, please? This is in build 15063. I've seen this happen when running an "npm install" on an actual source tree that's pulling in quite a few packages. npm will install packages, and will fail some of the way through with EACCESS during rename.
Race condition maybe, or as someone suggested, a "timeout" on forked process?

Please let me know whether you'd like an example. I can point you towards the github of the source tree that caused this in my environment.

@sgtoj
Copy link
Author

sgtoj commented May 31, 2017

Race condition maybe, or as someone suggested, a "timeout" on forked process?

My thoughts, exactly.

Although I have adjusted my development workflow to reduce the need to call npm install, I have not seen this issue occur on Build 16199. I am not sure if it is actually resolved or if I have not seen it because I am not calling npm install as often.

@sgtoj
Copy link
Author

sgtoj commented May 31, 2017

Spoke too soon. Issue occur again while running npm upgrade against package.json. Had to execute the command several times before it finished updating all the packages.

@thorsteneb
Copy link

@sgtoj , this appears resolved in build 16215. Can you confirm?

@sunilmut
Copy link
Member

Thanks for your post and sorry for the delay. I tried this on build 16215 and ended up with the message ENOENT: no such file or directory, open '/home/wsl/package.json'. That does not look like a repro of the issue. What step am I missing?

untitled

@thorsteneb
Copy link

@sunilmut The issue discussed here happens when pulling in a whole bunch of packages that are part of a javascript project. You can use 'npm init' to be walked through creating a dummy package.json if you want to test just installing one package, see https://nodesource.com/blog/your-first-nodejs-package/

If you want to see 'npm install' grabbing a whole bunch of packages, you could fork a javascript project. The one I'm using for testing is at https://github.com/symposion/roll20-shaped-scripts . Fork that, clone it locally, and have at it with 'npm install' (note that this package relies on a private repo for 'npm test' to work, it's normal for 'npm test' to fail out of the box on this one).

@NgxDev
Copy link

NgxDev commented Jun 17, 2017

I can also confirm that simply closing VSCode (or whatever editor/ide one might have that working folder opened in) allows for npm install to run properly, without any errors. I didn't have to restart anything else.

But this is still a bummer... Having to close the editor means we can't use bash through the integrated terminal that VSCode offers.

Windows 10 Pro, Version 1703, Build 15063.413
Ubuntu: 16.04.2 LTS

@thorsteneb
Copy link

@sunilmut I just had this happen to me again in 16232. Running 'npm install' a second time, it completed. There's definitely some form of timeout or race condition here.

@felixnorden
Copy link

Getting this error as soon as i try to update any sort of package, or install a package which seems to have an already existing dependency installed.

I have tried the following:

  • Tried different versions of node/npm through nvm
  • Turned off third party firewall
  • Installation through curl from nodejs website
  • Clean install of WSL itself

Each time the npm update fails, npm then in return gets removed and I have to reinstall the whole node version to get npm back

npm ERR! Linux 4.4.0-43-Microsoft
npm ERR! argv "/home/felixnorden/.nvm/versions/node/v6.11.2/bin/node" "/home/felixnorden/.nvm/versions
/node/v6.11.2/bin/npm" "i" "-g" "npm@latest"
npm ERR! node v6.11.2
npm ERR! npm  v3.10.10
npm ERR! path /home/felixnorden/.nvm/versions/node/v6.11.2/lib/node_modules/.staging/sshpk-0bf1fa9c
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename

npm ERR! enoent ENOENT: no such file or directory, rename '/home/felixnorden/.nvm/versions/node/v6.11.
2/lib/node_modules/.staging/sshpk-0bf1fa9c' -> '/home/felixnorden/.nvm/versions/node/v6.11.2/lib/node_
modules/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk'
npm ERR! enoent ENOENT: no such file or directory, rename '/home/felixnorden/.nvm/versions/node/v6.11.
2/lib/node_modules/.staging/sshpk-0bf1fa9c' -> '/home/felixnorden/.nvm/versions/node/v6.11.2/lib/node_
modules/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     /mnt/c/Users/Felix/npm-debug.log
npm ERR! code 1

@felixnorden
Copy link

felixnorden commented Aug 1, 2017

@MrCroft The problem for me is that it happens even among the global node modules. I also tried to update the files locally in the global modules folder, as suggested by the accepted answer at stackoverflow, but it doesn't work... At least that may be a good thing, compared to the odd behavior you're experiencing with the editor/ide?

@thorsteneb
Copy link

@felixnorden Have you tried this in Insider build 16251? I just tested again, opening two bash windows and running npm install on two separate projects at the same time to really stress the system - and it worked without a hitch.

Since the issue is intermittent, I think 16251 needs more testing before we can say "this appears to be fixed now."

@felixnorden
Copy link

@yorickdowne No, I'm on build 15063.502. Maybe I'll try that and I'll get back with the results!

@thorsteneb
Copy link

@felixnorden Be sure to test on a separate install / partition. Insider builds can be temperamental.

@felixnorden
Copy link

felixnorden commented Aug 3, 2017

@yorickdowne After the update things seem to be working fine. I've tried to do multiple clean installs of different node versions, updating both npm and other global packages and only did it fail once (the first time), which instead gave an ENOENT: No such file or directory, open error instead of rename, so I guess I'm safe for now. Thanks for the help!

@kaiwah
Copy link

kaiwah commented Aug 9, 2017

So I ended up having the same issue, and realized I had two conflicting NPM versions on my computer.

where npm will reveal if you have multiple npm's installed.

The cause of the issue was doing both apt install nodejs and apt install npm when in reality nodejs package already came with npm. Removing the npm and using the default npm with the nodejs package fixed it for me.

@NgxDev
Copy link

NgxDev commented Aug 9, 2017

@kaiwah wow, never tried that. Didn't realize you could have 2 versions of npm at the same time :)
To update npm I just simply run npm install -g npm - not saying that you wanted to update npm, I understood that you just didn't realize it came with nodejs.

Plus... I use nvm to manage different node versions. Not that I need multiple versions, but it makes it so easy to install node, set default version to be used (alias default) etc.
I come from windows, so... Installing stuff through command line still seems very weird for me :) actually, still on windows... Just using "bash on Ubuntu on Windows". Starting to like it.

Sent from my Samsung SM-G950F using FastHub

@kaiwah
Copy link

kaiwah commented Aug 10, 2017

@MrCroft yup! I use NVM now as well to swap between node versions. But when I first installed, I assumed apt install npm would automatically place the same bin as the one within nodejs package but it didn't -- but it definitely caused a problem. So when I tried to update npm, it was updating a different npm than the one that was used by default.

And I love WSL, but unfortunately it seems I will be going back to either Ubuntu native or GitBash as the WSL file system is too slow doubling my build times.

@Bartosz-Szopiera
Copy link

I'm new to npm, so I don't know how much of a solution this is for a more experienced user, but it works for me.

The mensioned problem:

...
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall rename
...

Intructions according to source:

mkdir ~/.npm-new  
npm config set prefix '~/.npm-new'  
export PATH=~/.npm-new/bin:$PATH  
source ~/.profile 

+ terminal restart

@thorsteneb
Copy link

@bart5, those instructions are for installing global npm packages without the need for sudo, by pointing npm at a local user directory for global files.
I'd just as soon run sudo npm -g install

The issue discusses here is for local, not global, npm install, only happens when a large amount of packages are being installed, and appears to be some kind of timeout or race condition.

And it appears it's fixed in all the current Insider builds.

@sgtoj
Copy link
Author

sgtoj commented Sep 15, 2017

This may be resolved? I haven't had any issues for awhile.

Edit: Using Windows 10 Insider's Build 16275

@rstaveley
Copy link

Is this likely to address a similar issue in Docker-for-Windows, running npm on a mounted volume from the host?

npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v6.10.3
npm ERR! npm  v3.10.10
npm ERR! path /data/node_modules/.staging/jmespath-fe653792
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall rename

npm ERR! Error: EACCES: permission denied, rename '/data/node_modules/.staging/jmespath-fe653792' -> '/data/node_modules/jmespath'
npm ERR!     at destStatted (/usr/local/lib/node_modules/npm/lib/install/action/finalize.js:25:7)
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:264:29
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)```

@amit-srivastava-007
Copy link

amit-srivastava-007 commented Nov 6, 2017

I am also facing same Issue with WSL Ubuntu in Windows v1709 (build 16299.15)

`npm ERR! Linux 4.4.0-43-Microsoft
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v6.11.5
npm ERR! npm v3.10.10
npm ERR! path /mnt/d/Projects/v2/ui/node_modules/leek
npm ERR! code ENOTEMPTY
npm ERR! errno -39
npm ERR! syscall rename

npm ERR! ENOTEMPTY: directory not empty, rename '/mnt/d/Projects/v2/ui/node_modules/leek' -> '/mnt/d/Projects/v2/ui/node_modules/.leek.DELETE'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /mnt/d/Projects/v2/ui/npm-debug.log`

@therealkenc
Copy link
Collaborator

therealkenc commented Dec 2, 2017

It looks like the original report, EACESS, was resolved some time back. 16275 was cited, so let's call it Fall Creators. There was also a tangent about having files opened elsewhere on the Win32 side (VS Code), but that's another matter. npm install in general sure works or people would have a fit; not withstanding presently open issues unrelated to the EACESS way above.

@amit-srivastava-007 & @Jefftopia - your ENOTEMPTY would be different. If you are still having difficulty, please open a new issue# and be sure to fill out the template including repro steps and an strace. Kernel programmers are not necessarily node experts so you'll need baby steps in order to get a lot of attention.

@EvanDarwin
Copy link

I have been experiencing what I believe to be the same issue with npm. For the last month or so this issue has been infuriating me but it only occurs once in a while, and my workaround has been to use yarn from within PowerShell because that will build the node_modules/ properly, and then do npm rebuild node-sass to get the WSL/Linux bindings to work in VS Code.

However, at this point I've had to resort to rebooting Windows when I start getting EACESS in Linux, because I am also unable to modify or delete the files even in Windows as Administrator. I am almost positive that these issues have something to do with the WSL's filesystem.

  1. Moving node_modules/ in PowerShell as Admin
PS C:\Users\Eva\Documents\Code\MyCode> move .\node_modules\ old_modules
move : Access to the path 'C:\Users\Eva\Documents\Code\MyCode\node_modules\' is denied.
At line:1 char:1
+ move .\node_modules\ old_modules
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (C:\Users\Eva\Do...Z\node_modules\:DirectoryInfo) [Move-Item], IOException
    + FullyQualifiedErrorId : MoveDirectoryItemIOError,Microsoft.PowerShell.Commands.MoveItemCommand
  1. Trying to run yarn in Windows
PS C:\Users\Eva\Documents\Code\MyCode> yarn
yarn install v1.3.2
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
error An unexpected error occurred: "EPERM: operation not permitted, lstat 'C:\\Users\\Eva\\Documents\\Code\\MyCode\\node_modules\\.yarn-integrity'".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\Eva\\Documents\\Code\\MyCode\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
  1. Trying to run plain npm in Windows
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, unlink 'C:\Users\Eva\Documents\Code\MyCode\node_modules\pure-color\convert\cmyk2rgb.js'
npm ERR! path C:\Users\Eva\Documents\Code\MyCode\node_modules\pure-color
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\Eva\Documents\Code\MyCode\node_modules\pure-color' -> 'C:\Users\Eva\Documents\Code\MyCode\node_modules\.pure-color.DELETE'
npm ERR!  { Error: EPERM: operation not permitted, rename 'C:\Users\Eva\Documents\Code\MyCode\node_modules\pure-color' -> 'C:\Users\Eva\Documents\Code\MyCode\node_modules\.pure-color.DELETE'
npm ERR!   cause:
npm ERR!    { Error: EPERM: operation not permitted, rename 'C:\Users\Eva\Documents\Code\MyCode\node_modules\pure-color' -> 'C:\Users\Eva\Documents\Code\MyCode\node_modules\.pure-color.DELETE'
npm ERR!      errno: -4048,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'rename',
npm ERR!      path: 'C:\\Users\\Eva\\Documents\\Code\\MyCode\\node_modules\\pure-color',
npm ERR!      dest: 'C:\\Users\\Eva\\Documents\\Code\\MyCode\\node_modules\\.pure-color.DELETE' },
npm ERR!   stack: 'Error: EPERM: operation not permitted, rename \'C:\\Users\\Eva\\Documents\\Code\\MyCode\\node_modules\\pure-color\' -> \'C:\\Users\\Eva\\Documents\\Code\\MyCode\\node_modules\\.pure-color.DELETE\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'rename',
npm ERR!   path: 'C:\\Users\\Eva\\Documents\\Code\\MyCode\\node_modules\\pure-color',
npm ERR!   dest: 'C:\\Users\\Eva\\Documents\\Code\\MyCode\\node_modules\\.pure-color.DELETE',
npm ERR!   parent: 'test-project' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Eva\AppData\Roaming\npm-cache\_logs\2017-12-14T22_58_22_383Z-debug.log

I was going to attach the output of WSL running npm, but I can't even get bash to give me a prompt and stop hanging, and I'm about to leave work.

I'm running Windows Version 1709 (OS Build 16299.125)

@mredbishop
Copy link

mredbishop commented Jan 26, 2018

I can also confirm that closing VSCode (the native linux one running in WSL) allows the npm install to run without error and I'm running Windows build 17074.rs_prerelease_flt.180116-1539.

Side note, mine is not a global install just a local install.

@therealkenc
Copy link
Collaborator

If VSCode is the blocker, then file an issue with the appropriate VSCode group.

It is not. #1956 #966 #2836 etc etc aka #1529

@dark-swordsman
Copy link

dark-swordsman commented Oct 10, 2019

Just wanted to add fuel to the fire here. I have confirmed that closing VSCode works for me, but that is still not acceptable.

I don't know a ton about lower level programming, symlinks, OS programming, etc. as a lot of you seem to have, but considering that in the past with things like the Bash terminal that used MYSYS2 haven't worked properly, I am not surprised that a Windows Linux implementation still doesn't work.

Don't get me wrong, I think it's awesome that I can use my natural instinctive linux commands. Honestly the only issues I have had with WSL are that I can't do multiple tabs with CMD (MobaXterm isn't a good replacement either with the hotkeys compared to Ubuntu 18.04) and this npm issue.

However, it's obvious that this Ubuntu "subsystem" is still subject to all of Windows's woes.

It's a shame this hasn't been fixed after having multiple issues open for over 3 years, but I guess npm install is a smaller issue than others they may have to deal with.

Hopefully this gets fixed at some point. I really love being able to develop on Windows as the Ubuntu Gnome UI isn't the best in comparison, but these small headaches add up to a poor experience. I haven't been developing for long, but I know a speed bump in workflow is a serious motivation killer.

@kdolan
Copy link

kdolan commented Oct 16, 2019

I solved this by mounting C:/ with default permissions bound to my user instead of root. I followed the guide here: https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/

sudo umount /mnt/c
sudo mount -t drvfs C: /mnt/c -o metadata,uid=1000,gid=1000,umask=22,fmask=111

This mounts all files on the C drive as my user instead of root. Therefore sudo is not needed to run npm i

@OneHoopyFrood
Copy link

Still seeing this today.

@dz-s
Copy link

dz-s commented Nov 14, 2019

Still having this issue

@indieocean
Copy link

+1

@jared-m-combs
Copy link

This issue occurs for me when the number of dependencies I install reaches a certain point. Its almost as if the filesystem isn't able to keep up and falls behind at a certain point. Very strange.

@markuspeloquin
Copy link

I have this problem, and I do not use VSCode. It occurs when I npm upgrade -g npm. Installing other things (npm install -g tslint) seems to work just fine.

I use https://github.com/tj/n to manage my node install (with N_PREFIX=$HOME/.local), and the bundled npm is sometimes outdated. Beside, I just like running npm upgrade -g and everything is updated.

I don't know if it's related, but I recently ran wsl --upgrade Debian, which migrated from LxFs to WslFs. The problems started happening around when I 'upgraded'. I wish there was a --downgrade option.

@gilly3
Copy link

gilly3 commented Dec 5, 2019

This seems to be related to #4537, which in turn may be related to #1529. Neither of those are closed.

@therealkenc
Copy link
Collaborator

therealkenc commented Dec 5, 2019

#4537 was given different treatment because it's a BSOD, and thus given some hope a minidump will make it's way though the works somehow. That the underlying problem experienced in this thread is #1529 + #1956 has been covered a few times.

The OP repro was:

$ npm install tslint --save-dev

Which you'll almost certainly find works. Hence the closed status here. This goes double for WSL2 which addresses #1529 on ext4.

[Notwithstanding someone (paraphrasing) "taking the better part of a day's effort to narrow a test case to something reproducible and actionable, in the (very small but nonzero) chance it was possible to demonstrate a problem that was not #1529 or #1956". The caveat being largely academic, mind, at least until those two flip status.]

@gilly3
Copy link

gilly3 commented Dec 5, 2019

I appreciate the work you're doing here. I just wanted to leave a signpost for future travelers who, like me, found this issue first, and were frustrated to discover it was closed, despite the steady stream of "me too" replies. The root cause seems to be under investigation, even if this higher level issue is closed.

Upon closer inspection, I see you provided links to some potentially related issues earlier in the thread. I missed those links on my first quick read through.

@phortonssf
Copy link

@kdolan Thank you solved my problem!

I solved this by mounting C:/ with default permissions bound to my user instead of root. I followed the guide here: https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/

sudo umount /mnt/c
sudo mount -t drvfs C: /mnt/c -o metadata,uid=1000,gid=1000,umask=22,fmask=111

This mounts all files on the C drive as my user instead of root. Therefore sudo is not needed to run npm i

@TheEssem
Copy link

Just encountered this issue after reinstalling WSL, and none of the listed solutions seem to be working. Here's my logs:
2020-01-16T21_14_52_622Z-debug.log

@jacobopolavieja
Copy link

Issue here too. Closing VSCode and redoing npm install from WSL directory went ok. Not ideal at all and I hope the team can find a solution to this. It interrupts the normal workflow with Node.

@davidcostadev
Copy link

Thanks @jacobopolavieja

@AngelJSD
Copy link

Giving up on WSL for now :(
Every time I get this error I have to reboot and that's not very productive.

This thread started May 2018 and the issue still persists today.

When I read this answer I realized that this issue only happened to me after I open VSCode from WSL. Reboot Windows worked fine for me, thanks @suprsidr. I think it could be a problem with the WSL extension of VSCode.
Note: Closing VSCode didn't work for me

@juangabrieldev
Copy link

This issue still exists for me.

@Number77asa
Copy link

Number77asa commented Feb 9, 2020

The cause of the issue for me was having a out of date package installed, in the package.json.
So, likely you've broken your npm by trying to fix your issue, so follow the below; worked for me.

  1. close all editors
    2)reboot vscode command: >Reload Window.
    3)In the directory you are in , install a clean node.js:
    https://nodesource.com/blog/installing-node-js-tutorial-using-nvm-on-mac-os-x-and-ubuntu/
  2. check: whereis npm --> to see if duplicate versions are installed. There should only by 1 npm path.
  3. sudo chown -R $USER:$(id -gn $USER) /home/adduser/.config
  4. Reinstall the latest versions of your package.json -- The cause of the issue for me was having a out of date package installed.

@h4de5
Copy link

h4de5 commented Feb 13, 2020

same here. freshly installed windows 10 (build 18363), node 12 installation using nvm, just rebooted, vsc is not started, trying to install latest npm - getting the same error.
I've never started anything related to node with sudo or as root, I am not installing it on a mounted drive, but in my users home directory - so nether symlinks nor access rights should be an issue. out of ideas..

@rainabba
Copy link

FWIW: Working in Docker (from WSL) largely solves these issues and is good practice for any number of reasons so perhaps that's a workaround that may make sense for you also? WSL went from unusable to more-than-sufficient. Also, working directly with the FS in WSL is slow while Docker runs in Windows-proper so it's FAR faster (especially for npm i).

@arthurborgesdev
Copy link

My colleague was having the same "rename error eacess" errors, but we found that he has been using a Ubuntu 16.04 WSL version. After uninstalling it and installing Ubuntu 18.04 WSL version, the problem ceased.

The command which originated the issue was yarn eslint --init.

@spanyukov
Copy link

In my case I was having 2 npm versions installed. One version was installed on WSL , another one on Windows. After removing Windows version I`ve got no errors yet..

@dolsem
Copy link

dolsem commented Apr 19, 2020

I'm having the same issue on WSL 2, the project folder is in my home directory, not a mounted NTFS partition. Not even restarts or using sudo help.

Edit: never mind, turns out my distro was on WSL 1. Also, seems like this was caused by the VS Code file watcher in my case. https://code.visualstudio.com/docs/remote/wsl#_i-see-eaccess-permission-denied-error-trying-to-rename-a-folder-in-the-open-workspace

@suprsidr
Copy link

One thing you might want to try is disable the vscode's file watcher on node_modules.

We have an older project that still uses gulp and part of the gulp serve:dev command was to rm -rf ./dist

since vscode was watching ./dist it failed
something like:

files.watcherExclude": {
	"**/dist/**": true,
	"**/shared/**": true,
	"**/.git/objects/**": true,
	"**/.git/subtree-cache/**": true,
	"**/node_modules/**": true
}

@zhiltsov-max
Copy link

WSL v1, Win 10 (1909) build 18363.778, Ubuntu 18.04

I had a clean system and updated node from default 8 to 12.x with apt as described in the official instructions. Then I got many errors like almost for every package:

npm WARN tar ENOENT: no such file or directory, open '<...>/node_modules/.staging/rxjs-c9f024ea/_esm2015/internal/operators/windowToggle.js'

Tried to close VS Code and use just a console - no immediate success.
The thing that helped was apt autoremove, which removed a bunch of node dependencies left after the previous (default) installation:

 gyp libc-ares2 libhttp-parser2.7.1 libjs-async libjs-inherits libjs-node-uuid libjs-underscore libssl1.0-dev libuv1  libuv1-dev node-abbrev node-ansi node-ansi-color-table node-archy node-async node-balanced-match node-block-stream node-brace-expansion node-builtin-modules node-combined-stream node-concat-map node-cookie-jar node-delayed-stream node-forever-agent node-form-data node-fs.realpath node-fstream node-fstream-ignore node-github-url-from-git  node-glob node-graceful-fs node-gyp node-hosted-git-info node-inflight node-inherits node-ini node-is-builtin-module  node-isexe node-json-stringify-safe node-lockfile node-lru-cache node-mime node-minimatch node-mkdirp  node-mute-stream node-node-uuid node-nopt node-normalize-package-data node-npmlog node-once node-osenv  node-path-is-absolute node-pseudomap node-qs node-read node-read-package-json node-request node-retry node-rimraf  node-semver node-sha node-slide node-spdx-correct node-spdx-expression-parse node-spdx-license-ids node-tar  node-tunnel-agent node-underscore node-validate-npm-package-license node-which node-wrappy node-yallist

@shalomsam
Copy link

shalomsam commented Apr 29, 2020

For me, the following 2 solutions worked -

@cj81499
Copy link

cj81499 commented Jun 17, 2020

@jakemitchellxyz
Copy link

@therealkenc Still having exactly this issue and many others are too. Any reason this isn't in your backlog?

@therealkenc
Copy link
Collaborator

Still having exactly this issue

No yer not. The exact - issue would be:

brian@PC-Main:/mnt/c/Users/Brian/OneDrive/Development/GitHub/testdouble.js$ npm install tslint --save-dev

It does not EACCES.

image

Your inexact issue is #1529 #1956 et al.

@microsoft microsoft locked and limited conversation to collaborators Aug 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests