Unable to install `acorn` npm package (inability to symlink on mounted drives)
EvHaus opened this issue ยท 52 comments
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
acorn
package 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
Did you run the bash window as administrator in Windows? My very limited understanding is that in order for you to actually have elevated permissions to the underlying file system (and probably other stuff) you need to open the window elevated.
Launching "Bash on Ubuntu on Windows" with "Run as administrator" did not help resolve this issue. The same error appears.
It appears, ln -s
doesn't work on the mounted drives, which is what's causing the issue:
cd /mnt/c/Windows/Temp
touch a
ln -s a b
> ln: failed to create symbolic link โbโ: Operation not permitted
Before going into possible solutions, I should point out that there are some issues with npm not related to symlinks. I have not tried acorn but will make certain this is one of our test.
I should also point out that we have added a little bit about the filesystem here: https://msdn.microsoft.com/en-us/commandline/wsl/faq.
That said, are you able to install acorn someplace under '/'?
That said, are you able to install acorn someplace under '/'?
No. This works:
cd /tmp
touch a
ln -s a b
But this doesn't:
root@localhost:/tmp# npm install acorn
npm WARN enoent ENOENT: no such file or directory, open '/tmp/package.json'
npm WARN tmp No description
npm WARN tmp No repository field.
npm WARN tmp No README data
npm WARN tmp No license field.
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 /tmp/node_modules/.staging/acorn-baee3507
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall rename
npm ERR! Error: EACCES: permission denied, rename '/tmp/node_modules/.staging/acorn-baee3507' -> '/tmp/node_modules/acorn'
npm ERR! at destStatted (/usr/lib/node_modules/npm/lib/install/action/finalize.js:25:7)
npm ERR! at FSReqWrap.oncomplete (fs.js:82:15)
npm ERR!
npm ERR! Error: EACCES: permission denied, rename '/tmp/node_modules/.staging/acorn-baee3507' -> '/tmp/node_modules/acorn'
npm ERR! at Error (native)
npm ERR! [Error: EACCES: permission denied, rename '/tmp/node_modules/.staging/acorn-baee3507' -> '/tmp/node_modules/acorn']
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! /tmp/npm-debug.log
EDIT: But I'm actually unable to install anything in /
. All npm packages seem to give that same error message. Tried in /tmp
as well as /home
.
Furthermore, trying to install a package globally returns an entirely new error:
root@localhost:/home# npm install -g acorn
Error: could not get uid/gid
net.js:135
this._handle.open(options.fd);
^
Error: EINVAL: invalid argument, uv_pipe_open
at Error (native)
at new Socket (net.js:135:18)
at createWritableStdioStream (internal/process/stdio.js:142:16)
at process.stdout (internal/process/stdio.js:10:14)
at console.js:99:37
at NativeModule.compile (node.js:395:5)
at Function.NativeModule.require (node.js:340:18)
at node.js:223:27
at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/uid-number/get-uid-gid.js:16:1)
at Module._compile (module.js:413:34)
at /usr/lib/node_modules/npm/node_modules/uid-number/uid-number.js:37:16
at ChildProcess.exithandler (child_process.js:209:5)
at emitTwo (events.js:100:13)
at ChildProcess.emit (events.js:185:7)
at maybeClose (internal/child_process.js:850:16)
at Socket.<anonymous> (internal/child_process.js:323:11)
at emitOne (events.js:90:13)
at Socket.emit (events.js:182:7)
at Pipe._onclose (net.js:475:12)
Sorry for all the error messages, just trying to post as much information for you guys as possible.
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.
@russalex This could be an issue with running the command as root. I was getting the same stack and the same "could not get uid/gid" running:
npm install npm -g
I found these switches --user and --unsafe-perm
unsafe-perm
- Default: false if running as root, true otherwise
- Type: Boolean
Set to true to suppress the UID/GID switching when running package
scripts. If set explicitly to false, then installing as a non-root user
will fail.user
- Default: "nobody"
- Type: String or Number
The UID to set to when running package scripts as root.
When I executed:
npm --user root --unsafe-perm true install npm -g
It gets all the way to the end and fails.
I tried again with a few different accounts existing and non-existing. It always makes it to the end and fails with this:
root@localhost:~# npm --user sync --unsafe-perm true install npm -g
- async-some@1.0.2 node_modules/npm/node_modules/async-some
npm ERR! Linux 3.4.0+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "--user" "sync" "--unsafe-perm" "true" "install" "npm" "-g"
npm ERR! node v5.10.1
npm ERR! npm v3.8.3
npm ERR! path /usr/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall rename
npm ERR! Error: EACCES: permission denied, rename '/usr/lib/node_modules/npm' -> '/usr/lib/node_modules/.npm.DELETE'
npm ERR! at moveAway (/usr/lib/node_modules/npm/lib/install/action/finalize.js:38:5)
npm ERR! at destStatted (/usr/lib/node_modules/npm/lib/install/action/finalize.js:27:7)
npm ERR! at FSReqWrap.oncomplete (fs.js:82:15)
npm ERR!
npm ERR! Error: EACCES: permission denied, rename '/usr/lib/node_modules/npm' -> '/usr/lib/node_modules/.npm.DELETE'
npm ERR! at Error (native)
npm ERR! [Error: EACCES: permission denied, rename '/usr/lib/node_modules/npm' -> '/usr/lib/node_modules/.npm.DELETE']
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! /root/npm-debug.log
I've got to call it a night, but I will try to look into it more tomorrow. Hopefully someone will have a workaround by then.
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:
/tmp$ npm install acorn
/tmp
โโโ acorn@3.0.4npm WARN enoent ENOENT: no such file or directory, open '/tmp/package.json'
npm WARN tmp No description
npm WARN tmp No repository field.
npm WARN tmp No README data
npm WARN tmp No license field.
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.
@russalex Thanks for the update! When files are written to /
where do they actually go? Somewhere on the C: partition? Will files written to /
disappear if Bash on Windows
is uninstalled?
I believe these are related.
@Buck-Rawgers I got the same issue even --user root
is used and run my bash as Administrator. Any ideas?
npm ERR! Linux 3.4.0+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "--user" "sync" "--unsafe-perm" "true" "install" "npm" "-g"
npm ERR! node v5.10.1
npm ERR! npm v3.8.3
npm ERR! path /usr/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall rename
npm ERR! Error: EACCES: permission denied, rename '/usr/lib/node_modules/npm' -> '/usr/lib/node_modules/.npm.DELETE'
npm ERR! at moveAway (/usr/lib/node_modules/npm/lib/install/action/finalize.js:38:5)
npm ERR! at destStatted (/usr/lib/node_modules/npm/lib/install/action/finalize.js:27:7)
npm ERR! at FSReqWrap.oncomplete (fs.js:82:15)
npm ERR!
npm ERR! Error: EACCES: permission denied, rename '/usr/lib/node_modules/npm' -> '/usr/lib/node_modules/.npm.DELETE'
npm ERR! at Error (native)
npm ERR! [Error: EACCES: permission denied, rename '/usr/lib/node_modules/npm' -> '/usr/lib/node_modules/.npm.DELETE']
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! /root/npm-debug.log
@Buck-Rawgers until a update comes out fixing symlinks, there isn't much to do at this point.
@EvNaverniouk go to %LOCALAPPDATA%\lxss\root
and you will find the files that you are looking for (if I understood the first part of your most recent question).
any solution available ?
@592da Apparently the Microsoft team has been making some progress here. We're waiting for a new update to Bash on Windows to give it another try. But so far it sounds like if you want to use npm
you will need to do it on files in /
and NOT on your mounted /mnt/*
drives. Which is a bit of a bummer but still better than nothing. We have to wait and see what the team can do.
New build is out :http://aka.ms/wip14328
Release notes for Bash on Ubuntu on Windows are here: https://msdn.microsoft.com/en-us/commandline/wsl/release_notes
I can confirm that npm working (without -g) on / is in the build. Getting these links on /mnt/ is working internally and will soon get onto the release pipeline. No ETA on when it will hit the public.
Keeping this one open until full solution hits the public.
@russalex Did some testing on Build 14328 and can confirm your notes
- โ
npm install acorn
(and many other packages I tried) works in/tmp
- ๐ข
npm install -g acorn
still doesn't work (sameuv_pipe_open
error) - ๐ข
npm install acorn
still doesn't work in/mnt/*
(samesymlink operation not permitted
error)
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.
Still having an symlink error on /mnt on build 14328
does not work for
npm install -g tldr
I've "fixed" npm to install global packages into the home directory via .npmrc
prefix=/home/peter/.npm-packages
Now I'm getting a new error when I try installing any package:
npm install -g yo
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
npm ERR! Linux 3.4.0+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "yo"
npm ERR! node v5.10.1
npm ERR! npm v3.8.3
npm ERR! code EIO
npm ERR! EIO: i/o error, read
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! /home/peter/npm-debug.log
npm --version
3.8.3
node --version
v5.10.1
Known issues for -g and for /mnt/x drives. Fixes are inbound. Can't promise an ETA. I'll make certain they are in the release notes when they land on the Insider ring.
thanks
Did this make it into Build 14332?
@m4tta Just tried to install grunt with -g and getting EACCESS errors, so looks like not(?).
New release (14342), time to comment here. Some good news and some bad news.
The good news:
npm install acorn
on/mnt/*
drives now installssudo npm install -g acorn
also installs
Now the bad news.
- Issue #313 looks to be breaking some npm packages (have not tested them all but know this is a bad bug). We have a fix inbound which we are planning on getting out on the next insider release. I have tried
sudo npm install -g yo
with the fix and it looked to install. Right now I believe this is the last of the npm blockers.
I was having a lot of npm
errors after upgrading to Build 14352. So I did a full re-install of Bash For Windows (using these instructions: #4 (comment)). 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 acorn
works in /tmp - โ
sudo npm install -g acorn
also works - โ
npm install acorn
also works in/mnt/*
Incredible work @russalex & team. I am now unblocked to do my day-to-day work using Bash On Windows! Closing issue!
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!
I also faced that issue. I got that solved by using windows PewerShell. Try run PewerShell in administrator mode and run npm update
. This will show you the list of modules which are not compatible with windows architecture but installation will be completed. I also did downgraded the npm to version 3.10.5.
- run PowerShell with administrator privilege.
- https://github.com/felixrieseberg/npm-windows-upgrade
- npm install in the project folder
Hope this might help someone.
try npm install acorn --no-bin-links
https://docs.npmjs.com/misc/config#bin-links
Pulled my hair out on this one, but this problem seems to still exist when the /mnt/'ed drive is a ReFS partition.
kyle@DMC100:/mnt/d/dev/test$ npm install acorn
61 verbose stack Error: EIO: i/o error, symlink '../acorn/bin/acorn' -> '/mnt/d/dev/test/node_modules/.bin/acorn'
62 verbose cwd /mnt/d/dev/test
63 verbose Linux 4.4.0-43-Microsoft
64 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "acorn"
65 verbose node v8.9.3
66 verbose npm v5.6.0
67 error path ../acorn/bin/acorn
68 error code EIO
69 error errno -5
70 error syscall symlink
71 error EIO: i/o error, symlink '../acorn/bin/acorn' -> '/mnt/d/dev/test/node_modules/.bin/acorn'
72 verbose exit [ -5, true ]
Same here. I also get this error.
In mycase /vagrant is ashared from the windows host.
24578 verbose Linux 4.4.0-72-generic
24579 verbose argv "/usr/bin/node" "/usr/bin/npm" "install"
24580 verbose node v8.9.4
24581 verbose npm v5.6.01
24582 error path ../acorn/bin/acorn
24583 error code ENOTSUP
24584 error errno -95
24585 error syscall symlink
24586 error nospc ENOTSUP: operation not supported on socket, symlink '../acorn/bin/acorn' -> '/vagrant/basix-dark/node_modules/.bin/acorn'
24587 error nospc There appears to be insufficient space on your system to finish.
24587 error nospc Clear up some disk space and try again.
24588 verbose exit [ -95, true ]
Is the symlinks bug still present?
OS build :16299.192
Node: 9.4.0
Npm: 5.6.0
Output:
npm ERR! path ../nodemon/bin/nodemon.js
npm ERR! code Unknown system error -75
npm ERR! errno -75
npm ERR! syscall symlink
npm ERR! Unknown system error -75: Unknown system error -75, symlink '../nodemon/bin/nodemon.js' -> '
/mnt/d/workspace/affinity_v1/server/node_modules/.bin/nodemon'
I can install it with --no-bin-links
... do we have a spot tracking separate issues with npm install -g ? i'm unable to install phantomjs-prebuilt via npm install -g, though i can install it into a local home directory, and then manually mv it to /usr/lib/node_modules, making it work
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
I've tried powershell as administrator, using ubuntu - logged in as root, and not as root - doesn't fix the symlink problem.
I've uninstalled and reinstalled with lxrun.... doesn't fix the symlink problem.
I've uninstalled and reinstalled from the microsoft site.... doesn't fix the symlink problem.
Installing a module with --no-bin-links does work, but trying to work on a large project and having to manually install each module that might have symlinks or needed globally, with --no-bin-links each time doesn't seem like a good option for developers.
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 users
However I have difficulties to install packages, even with --no-bin-link
flag :
npm ERR! path /mnt/c/Users/aymeric/Documents/PROJECTS/nodejs/Roadmap/node_modules/.static-eval.DELETE/node_modules/esprima
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall rename
npm ERR! Error: EACCES: permission denied, rename '/mnt/c/Users/aymeric/Documents/PROJECTS/nodejs/Roadmap/node_modules/.static-eval.DELETE/node_modules/esprima' -> '/mnt/c/Users/aymeric/Documents/PROJECTS/nodejs/Roadmap/node_modules/static-eval/node_modules/esprima'
npm ERR! { [Error: EACCES: permission denied, rename '/mnt/c/Users/aymeric/Documents/PROJECTS/nodejs/Roadmap/node_modules/.static-eval.DELETE/node_modules/esprima' -> '/mnt/c/Users/aymeric/Documents/PROJECTS/nodejs/Roadmap/node_modules/static-eval/node_modules/esprima']
...
I have Windows 10 Enterprise, v1703, OS build 15063.540
Based on this other issue #14 I tried to close everything and I rebooted: and it worked! Looks like it's effectively a EBUSY
issue and not a EACCESS
...
The resolution: close everything that could interact with the folder (like SublimeText and other stuff) to make it work.
Thanks
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-links
trick otherwise I get the PERM error on symlink mentionned above.
And it won't link any binaries in node_modules/.bin
so it's not a viable solution anyway.
I have the same issue. Is there any progress on this?
I'm having the same issue.
For anyone having this issue with docker on windows, using the windows container solves this issue with symlinks.
Same issue, using npm directly on windows 10 installing acorn
I ran into the same issue on /mnt/d
which is just a separate partition on my main hard-drive. Wondering could it be because it's formatted as exFAT (for better interoperability with native linux)? Perhaps symlinks only work in WSL on NTFS drives?
I also struggled with this for a while. It turned out that, indeed, exFAT doesn't support symlinks. I reformatted the partition to NTFS and it all works without a hitch ever since.
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:
- Close VS Code or anything also accessing the files you are working on
- Have only the WSL terminal open
- Install desired
npm
packages via terminal - Reopen VS Code/Editor/etc
This issue happens again, please reopen it!
Just ran into this error as well.
Installing WSL2 should fix this issue, btw.
I'm still having this issue! Did anyone fixed it?
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.