You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to install acorn npm package (inability to symlink on mounted drives) #3
Try to install the acorn package via npm 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 work
npm 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
Reacted by Denis Washington, Jacqueline, Fiacc O'Brien Moran, Mickey, Vasily Alexeev, Toni DY, Dylan Frankland, rs6g10, Stanislav, Alex Paluzzi and 14 more
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.
changed the title [-]Unable to install `acorn` npm package[/-][+]Unable to install `acorn` npm package (inability to symlink on mounted drives)[/+]on Apr 7, 2016
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.
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.
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.
Russ Alexander (@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.
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.4
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.
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.
Russ Alexander (@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?
@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).
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
Reacted by David Piper, Christian Quispe H and Kris Lynn
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 Aymeric (@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
Reacted by Noah Manneschmidt, Robert Koch, Tao-Oak, Mehdi, Josef Norlin, Lucia Velasco, Gary Mansell and Francis Mendoza
Reacted by Arturs Vancans, Salman K.A.A, Rodrigo Gomes da Silva, Ahmad Raza, Ryuko, Simon Carter, Ryder Xie, Joselito, mmdevcodes, Umur Kontacı and 5 more
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.
Activity
mizzle-mo commentedon Apr 7, 2016
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.
EvHaus commentedon Apr 7, 2016
Launching "Bash on Ubuntu on Windows" with "Run as administrator" did not help resolve this issue. The same error appears.
EvHaus commentedon Apr 7, 2016
It appears,
ln -sdoesn't work on the mounted drives, which is what's causing the issue:[-]Unable to install `acorn` npm package[/-][+]Unable to install `acorn` npm package (inability to symlink on mounted drives)[/+]russalex commentedon Apr 7, 2016
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 '/'?
EvHaus commentedon Apr 7, 2016
No. This works:
But this doesn't:
EDIT: But I'm actually unable to install anything in
/. All npm packages seem to give that same error message. Tried in/tmpas well as/home.Furthermore, trying to install a package globally returns an entirely new error:
Sorry for all the error messages, just trying to post as much information for you guys as possible.
russalex commentedon Apr 7, 2016
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.
jokeyrhyme commentedon Apr 7, 2016
Related to #6 and/or #9 ?
mizzle-mo commentedon Apr 7, 2016
Russ Alexander (@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:
I found these switches --user and --unsafe-perm
When I executed:
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:
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.
russalex commentedon Apr 7, 2016
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.
EvHaus commentedon Apr 7, 2016
Russ Alexander (@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 ifBash on Windowsis uninstalled?jgchristopher commentedon Apr 8, 2016
#14
I believe these are related.
mickeyinfoshan commentedon Apr 11, 2016
@Buck-Rawgers I got the same issue even
--user rootis used and run my bash as Administrator. Any ideas?jgchristopher commentedon Apr 11, 2016
@Buck-Rawgers until a update comes out fixing symlinks, there isn't much to do at this point.
trevren11 commentedon Apr 11, 2016
@EvNaverniouk go to
%LOCALAPPDATA%\lxss\rootand you will find the files that you are looking for (if I understood the first part of your most recent question).27 remaining items
Aymkdn commentedon Aug 21, 2018
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 #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
warpdesign commentedon Sep 28, 2018
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.ramonakira commentedon Oct 20, 2018
I have the same issue. Is there any progress on this?
EricLambrecht commentedon Jan 20, 2019
I'm having the same issue.
nikoinist commentedon Mar 31, 2019
For anyone having this issue with docker on windows, using the windows container solves this issue with symlinks.
jsonMartin commentedon Apr 23, 2019
Same issue, using npm directly on windows 10 installing acorn
mrvdot commentedon May 29, 2019
I ran into the same issue on
/mnt/dwhich 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?mfilkov commentedon Aug 7, 2019
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.
madewithsalt commentedon Sep 8, 2019
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 Aymeric (@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 terminalmaixuanhan commentedon Jan 1, 2020
This issue happens again, please reopen it!
kaosaxis commentedon Jan 3, 2020
Just ran into this error as well.
slikts commentedon Jan 3, 2020
Probably the same issue as #1529.
fatso83 commentedon Mar 11, 2020
Installing WSL2 should fix this issue, btw.
jerry-santana commentedon Mar 21, 2020
I'm still having this issue! Did anyone fixed it?
kleinesfilmroellchen commentedon Jul 2, 2022
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.