WSL: Unable to install `acorn` npm package (inability to symlink on mounted drives)
Steps to reproduce:
- Launch “Bash on Ubuntu on Windows” (note that it appears to use the ‘root’ user by default)
- Install nodejs via:
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash - sudo apt-get install -y nodejs- Try to install the
acornpackage vianpm install acorn
You’ll get this message:
npm ERR! Linux 3.4.0+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "acorn"
npm ERR! node v5.10.1
npm ERR! npm v3.8.3
npm ERR! path ../acorn/bin/acorn
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! syscall symlink
npm ERR! Error: EPERM: operation not permitted, symlink '../acorn/bin/acorn' -> '/mnt/r/path/node_modules/.bin/acorn'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM: operation not permitted, symlink '../acorn/bin/acorn' -> '/mnt/r/path/node_modules/.bin/acorn']
npm ERR! errno: -1,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'symlink',
npm ERR! path: '../acorn/bin/acorn',
npm ERR! dest: '/mnt/r/path/node_modules/.bin/acorn',
npm ERR! parent: 'myproject' }
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! /mnt/r/path/npm-debug.log
Not sure how to proceed as I’m already root with full permissions
UPDATE: For other nodejs developers finding this issue. Here is what I seem to have uncovered so far:
npm install -g {anything}doesn’t seem to worknpm install {anything}doesn’t seem to work if installing anywhere on/npm install {some_packages}on/mnt/{something}sometimes doesn’t work depending on whether or not that package needs to create symlinks
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Reactions: 24
- Comments: 52 (8 by maintainers)
try
npm install acorn --no-bin-linkshttps://docs.npmjs.com/misc/config#bin-linksInstalling WSL2 should fix this issue, btw.
This issue happens again, please reopen it!
I ran into this issue while setting up a new Project with VSCode using the VSCode-remote functionality. I’m running an Ubuntu Linux VM in WSL for development work.
The comment from @Aymkdn was spot on - in my case it was an EBUSY, not an EACCES error, due to the fundamental ‘feature’ of NTFS - if a directory is in use by another application (in this case, VSCode), it cannot be modified or deleted. Acorn’s need to delete that one file threw everything out of whack. 😃
Remediation:
npmpackages via terminalIs the symlinks bug still present?
Output:
I can install it with
--no-bin-linksNew build is out (14352). This should fix the issue in #313.
All known npm bugs are now fixed. Please report if anything else looks odd.
It appears,
ln -sdoesn’t work on the mounted drives, which is what’s causing the issue:me also facing this issue in WSL/Debian, node 10.2.1, npm 6.1.0, using nvm –no-bin-links flag is not helping
Same permission issue here.
I tried to create a simple symlink and it worked:
aymeric@box:/mnt/c/Users/aymeric/Desktop$ ln -s /mnt/c/Users usersHowever I have difficulties to install packages, even with
--no-bin-linkflag :I have Windows 10 Enterprise, v1703, OS build 15063.540
Based on this other issue https://github.com/Microsoft/WSL/issues/14 I tried to close everything and I rebooted: and it worked! Looks like it’s effectively a
EBUSYissue and not aEACCESS…The resolution: close everything that could interact with the folder (like SublimeText and other stuff) to make it work.
Thanks
I was having a lot of
npmerrors after upgrading to Build 14352. So I did a full re-install of Bash For Windows (using these instructions: https://github.com/Microsoft/BashOnWindows/issues/4#issuecomment-206657867). Then after re-installing node (using these instructions https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions) I can confirm:npm install acornworks in /tmpsudo npm install -g acornalso worksnpm install acornalso works in/mnt/*Incredible work @russalex & team. I am now unblocked to do my day-to-day work using Bash On Windows! Closing issue!
New release (14342), time to comment here. Some good news and some bad news.
The good news:
npm install acornon/mnt/*drives now installssudo npm install -g acornalso installsNow the bad news.
sudo npm install -g yowith the fix and it looked to install. Right now I believe this is the last of the npm blockers.Ok, good news and bad news.
First the good news. Running through the steps on /tmp on one of our dev branches. Looks like there’s a fix inbound. This morning I was able to:
Bad news is that this does not work through /mnt/c. I’ll need to write a bug on that one.
The team is hard at work fixing bugs. Every build we put out should have visible improvements. Not certain when this one will hit the insider flight, but it is inbound.
Launching “Bash on Ubuntu on Windows” with “Run as administrator” did not help resolve this issue. The same error appears.
This is STILL an issue in 2022. Debian 12, 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 GNU/Linux, nodejs v16.15.1, npm 8.13.1.
I’m having the same issue.
I have the same issue. Is there any progress on this?
I am still having the same problem: cannot install acorn on a mounted usb drive (/mnt/d): is it supposed to be fixed?
I had to use the
--no-bin-linkstrick otherwise I get the PERM error on symlink mentionned above.And it won’t link any binaries in
node_modules/.binso it’s not a viable solution anyway.I am so glad to hear you say that! This amazing GitHub community has been a huge part of how we have been able to iterate so quickly. Thank you from all of us!
@russalex Did some testing on Build 14328 and can confirm your notes
npm install acorn(and many other packages I tried) works in/tmpnpm install -g acornstill doesn’t work (sameuv_pipe_openerror)npm install acornstill doesn’t work in/mnt/*(samesymlink operation not permittederror)Amazing work so far! And incredible community outreach from the Microsoft team working on this project. Really excited to try out the next public release.
#14
I believe these are related.
Actually, love the info. Thanks!
I’ll take this up to the devs tomorrow. The fact that you’re seeing the socket error makes me think that we have a bug someplace in our code. I’ll make certain it gets to the right place.