Closed pallatee closed 8 years ago
There is another wired thing about npm. When I try to install gulp globally I get:
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)
Same here. In fact if I try to update npm update -g npm@latest it attempts to copy lodash to the staging directory then throws the errror. Following this subsequent attempts to use npm are broken because it can no longer find lodash.
IMPORTANT
This really should be of utmost importance to the team. I for one was very excited and love how everything else works, but as you are adding this feature to windows with the intention of bringing web developers back to windows this needs fixing ASAP. This alone will stop me switching back to windows for web development and I'm sure it will be the same for many. It defeats the purpose of switching for me. Please please please fix.
@borovaka you can fix that error by allowing unsafe perms
npm config set unsafe-perm=true
Already tried. It bypasses the error but it still doesn't work. You will get a permissions access error still or at least I did.
On Friday, April 8, 2016, John Christopher notifications@github.com wrote:
@borovaka https://github.com/borovaka you can fix that error by allowing unsafe perms
npm config set unsafe-perm=true
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/Microsoft/BashOnWindows/issues/14#issuecomment-207504657
@jamesscholeyweb right, I was able to get to your error after setting those perms. Otherwise I wasn't able to do anything.
This seems to be the underlying issue.
root@localhost:/usr/lib/node_modules/.staging# rename /usr/lib/node_modules/.staging/lodash-24c8c2f4 /usr/lib/node_modules/ember-cli/node_modules/babel-core/node_modules/lodash Bareword found where operator expected at (eval 1) line 1, near "24c8c2f4" (Missing operator before c8c2f4?) Unknown regexp modifier "/b" at (eval 1) line 1, at end of line syntax error at (eval 1) line 1, near "/."
Related: https://github.com/Microsoft/CommandLine-Documentation/issues/26
It seems to be an issue with symlinks
Confirmed - this is totally related to the symlink issue.
Same here with
npm install typescript
Here's the output
npm WARN enoent ENOENT: no such file or directory, open '/root/package.json'
npm WARN root No description
npm WARN root No repository field.
npm WARN root No README data
npm WARN root No license field.
npm ERR! Linux 3.4.0+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "typescript" "gulp" "tsd"
npm ERR! node v5.10.1
npm ERR! npm v3.8.3
npm ERR! path /root/node_modules/.staging/ansi-regex-0de81b15
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall rename
npm ERR! Error: EACCES: permission denied, rename '/root/node_modules/.staging/ansi-regex-0de81b15' -> '/root/node_modules/ansi-regex'
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 '/root/node_modules/.staging/ansi-regex-0de81b15' -> '/root/node_modules/ansi-regex'
npm ERR! at Error (native)
npm ERR! [Error: EACCES: permission denied, rename '/root/node_modules/.staging/ansi-regex-0de81b15' -> '/root/node_modules/ansi-regex']
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
This looks a lot like #3. We can keep the conversation going on there.
What I can say right now is that things are getting better (at least in non-mnt directories.). On my dev box I see:
russ@RUSSALEX-DESK:~/tmp$ npm list
/home/russ/tmp
├── acorn@3.0.4
├─┬ gulp@3.9.1
│ ├── archy@1.0.0
│ ├─┬ chalk@1.1.3
│ │ ├── ansi-styles@2.2.1
│ │ ├── escape-string-regexp@1.0.5
│ │ ├─┬ has-ansi@2.0.0
│ │ │ └── ansi-regex@2.0.0
│ │ ├─┬ strip-ansi@3.0.1
│ │ │ └── ansi-regex@2.0.0
│ │ └── supports-color@2.0.0
│ ├── deprecated@0.0.1
│ ├─┬ gulp-util@3.0.7
│ │ ├── array-differ@1.0.0
It goes on from there. I should point out that I have not tried to actually use any of these, I have only installed them.
The team is hard at work getting stuff up and running. Npm is one of those things we're looking at now.
Full disclosure here. Doing a little more testing on our internal build and finding that doing an "npm -g install
We have someone looking into it.
This seems also to be a valid issue when running npm in the new Windows 10 Bash
This solved it for me: https://gist.github.com/mattpodwysocki/4e6951fc93adae064a73ed0b2251d180
npm config set unsafe-perm true
I have no idea what it does however.
If you are using with -g option, try to remove it.
FWIW, installing lodash
as per the OP's request works fine on build 14931!
I just ran into this trying to do npm install -g ember-cli/ember-cli
on 15063.2. :confused:
npm config set unsafe-perm=true
fixed it, but makes me uneasy.
You can bypass all permission problems by changing the prefix for npm. See option 2: https://docs.npmjs.com/getting-started/fixing-npm-permissions
Actually I had already set the prefix
to a local user directory, and I was still getting this error.
To fully repro:
npm config set prefix="${HOME}/my-special-npm-directory"
npm install -g ember-cli/ember-cli
Hey, I just managed to fix an issue with my setup by taking ownership of the folder that Node was installed to. I use NVM to manage node versions, so in my case Node was installed in /home/myusername/.nvm
.
So, to fix it, I used sudo chown -R myusername:myusername /home/myusername/.nvm
. Weirdly enough, I had to run that command again each time I installed something globally, and I don't know enough to figure out why. It's a mystery!
The error still happens in Windows 10 Creator's Update 10.0.15063
. Here is what I tried:
npm install -g npm
check that npm was actually updated (>=4.4.4
). Run hash -r
to update bash cache. ~/.profile
is not executed in current BashOnWindows, so move all npm-related PATH
modifications from ~/.profile
to ~/.bashrc
.chown
ed by a user, I still run sudo npm install enduro -g
.Does this happen if you don't use sudo
in step 3?
@aseering no, it didn't work unfortunately, same rename error on node v6.10.2
and npm 4.4.4
.
My anti-virus was blocking the download of packages. Thanks ilyaigpetrov.
I used @Sparticuz suggested soluction and it's working fine.
restart your bash. It seems there's some permission timeout with forked(?) process.
Fixed this issue by putting sudo pm uninstall -g ember-cli
npm config set unsafe-perm=true work for me, thanks
sudo npm install -g npm@5.3.0
that sorted it for me
following @vinifala suggestion (reverting npm v5.4.0 to 5.3.0) fixed my recent permissions issues on Windows 10 git bash.
npm install -g npm@5.3.0
I just change my npm@5.4.1
to npm@5.3.0
, it's fine now.
You can use npm i -g npm@5.3.0
to downgrade.
@nagarajanewlife npm i npm@5.3.0
On windows 10 I was trying to update dependencies in my project with npm update --save
and it was returning permission errors. I tried to start the console in administrator mode but it wasn't solving the problem.
But with npm config set unsafe-perm=true
it worked
I fixed this issue using npm install -g npm@next I am working on a Windows 7 pro
First, I tried doing sudo npm i -g npm
but it did not work. Then, I tried the option 1 here and got it to work.
Ergg... only thing that worked for me was to run my npm install in cmd.exe
- couldn't get it to work in WSL bash.
@ilanc - did you sudo your npm install -g ...
?
I'm running node 8.8.1 This is how I managed to get this to work:
1) Start CMD.exe
2) Type bash
3) sudo npm install -g npm@5.3.0
With the normal bash i could not get this to work.
@bitcrazed apologies for the delay. I wasn't doing global installs I was just doing a local install i.e. I was attempting to add @await/event
to my package.json using npm i "@await/event" --save-dev
. I kept getting EACCES
errors. I tried npm cache clean
- don't think I tried npm config set unsafe-perm true
- and then tried the same npm command within cmd.exe and it worked.
I'm unable to repeat the problem though - I just tried to create a new project today with npm init
and npm i "@await/event" --save-dev
- and it worked without problems in WSL bash.
sorry I can't give you more info to help pin it down, npm does seem to be behaving a bit more erratically in WSL of late but I'm usually able to get passed it with either (1) npm cache clean
or (2) running in cmd.exe - so I haven't bothered to dig too deeply.
Thanks for the note. Could well be that something else in your dependency graph was trying to do something that required root, but has since been fixed to permit local installation.
For example, in the OP's case, npm returned this:
npm ERR! path /root/test/node_modules/.staging/lodash-9a2aabe2
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall rename
npm ERR! Error: EACCES: permission denied, rename '/root/test/node_modules/.staging/lodash-9a2aabe2' -> '/root/test/node_modules/lodash'
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)
Here, the rename syscall was attempted by a process with insufficient rights, hence the EACCES
error.
Let us know if you see these issues in the future, though double-check whether you have to sudo
first, and/or compare the same action as a non-root user in a Linux VM.
@bitcrazed Ah interesting. I definitely had that problem in this case too (i.e. where the npm error message says 'EACCES ... blah ... try sudo' and then you try using sudo and it just gives you the same error message).
How do I tell whether I have the fix? I assume it's a fix in WSL bash?
I don't know if this applies, but I see many Mac users experiencing this issue due to macOS' different, sometimes more permissive security model vs. Linux.
This most often presents when a Mac user who authors or changes a node/npm package without realizing that their change will not work without sudo elevation on Linux.
I don't believe the fix was due to us - more likely that one of the packages was updated to eliminate this issue, though without a repro, it's hard to tell.
I had this issue and it turned out to be my AV. Disabled my AV and npm install worked.
I had this issue in WSL on windows. I had upgraded npm to 5.6.0 as it said there was an update available. Now I'm just using the Npm 5.5.1 that came with node 8.9.3.
So the problem seems to be updating Npm.
please help! how can i fix this? it gives the same error when i run the cmd as Administrator
npm ERR! path C:\Users\Kadon\AngularProjectX\node_modules\fsevents\node_modules npm ERR! code EPERM npm ERR! errno -4048 npm ERR! syscall rmdir npm ERR! Error: EPERM: operation not permitted, rmdir 'C:\Users\Kadon\AngularProjectX\node_modules\fsevents\node_modules' npm ERR! { Error: EPERM: operation not permitted, rmdir 'C:\Users\Kadon\AngularProjectX\node_modules\fsevents\node_modules' npm ERR! stack: 'Error: EPERM: operation not permitted, rmdir \'C:\Users\Kadon\AngularProjectX\node_modules\fsevents\node_modules\'', npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'rmdir', npm ERR! path: 'C:\Users\Kadon\AngularProjectX\node_modules\fsevents\node_modules' }
I am facing the same issue, npm config set unsafe-perm=true
or node/npm upgrade didn't help.
Windows 10 (10.0.16299.309) @ WSL Ubuntu
node v9.9.0
npm 5.6.0
For instance I am trying to npm install
this repo: https://github.com/jenkins-docs/simple-node-js-react-npm-app
And getting this error:
username@Username-PC:/mnt/d/web/JavaScriptApps/jenkins-test$ npm install
npm ERR! path /mnt/d/web/JavaScriptApps/jenkins-test/node_modules/loader-fs-cache
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall rename
npm ERR! Error: EACCES: permission denied, rename '/mnt/d/web/JavaScriptApps/jenkins-test/node_modules/loader-fs-cache' -> '/mnt/d/web/JavaScriptApps/jenkins-test/node_modules/.loader-fs-cache.DELETE'
npm ERR! { Error: EACCES: permission denied, rename '/mnt/d/web/JavaScriptApps/jenkins-test/node_modules/loader-fs-cache' -> '/mnt/d/web/JavaScriptApps/jenkins-test/node_modules/.loader-fs-cache.DELETE'
npm ERR! cause:
npm ERR! { Error: EACCES: permission denied, rename '/mnt/d/web/JavaScriptApps/jenkins-test/node_modules/loader-fs-cache' -> '/mnt/d/web/JavaScriptApps/jenkins-test/node_modules/.loader-fs-cache.DELETE'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rename',
npm ERR! path: '/mnt/d/web/JavaScriptApps/jenkins-test/node_modules/loader-fs-cache',
npm ERR! dest: '/mnt/d/web/JavaScriptApps/jenkins-test/node_modules/.loader-fs-cache.DELETE' },
npm ERR! stack: 'Error: EACCES: permission denied, rename \'/mnt/d/web/JavaScriptApps/jenkins-test/node_modules/loader-fs-cache\' -> \'/mnt/d/web/JavaScriptApps/jenkins-test/node_modules/.loader-fs-cache.DELETE\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rename',
npm ERR! path: '/mnt/d/web/JavaScriptApps/jenkins-test/node_modules/loader-fs-cache',
npm ERR! dest: '/mnt/d/web/JavaScriptApps/jenkins-test/node_modules/.loader-fs-cache.DELETE',
npm ERR! parent: 'my-app' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
Surprisingly Yarn is able to install dependencies.
For anyone facing this issue: If you have mounted any windows folder in ubuntu so that you can use the command line functionalities and also GUI code editors through windows, this is bound to happen. Its because of some file locking rules done by windows.
So whenever this error comes up, close all the code editors or any other programs using this mounted folder in windows.
This has worked for me all the time.
It's hard to tell now what has fixed my issue, since I rebooted computer since then, but now it is gone. Will try IDE trick next time... thanks!
If you have mounted any windows folder in ubuntu so that you can use the command line functionalities and also GUI code editors through windows, this is bound to happen
This whole two year thread is #1529. The problem here is not permissions and never has been. [It is utterly unrelated to #3 which was a symlink problem, and how this one got closed.] You can install your whole NodeJS ecosystem as user yourself; you are still going to trip #1529. I asked in a related post that WSL at least throw off a (nonconforming) EBUSY
so we could differentiate from actual EACESS
problems but there was no response (what you gonna do).
Closing editors will help, if the thing holding open a handle is an editor. But if you take the example a couple of posts back, .loader-fs-cache
is still holding a handle. No one is editing anything there. Y'all have been rebooting and discovering "works fine now", because you've closed all the handles. And the thing is you've got open handles in node in spades much of the time, because of the client-server nature of the beast.
For now you can (a) be meticulous about making sure there are no file handles open in your node universe before running npm
(b) hope that your node packages get updated to be more tolerant of the problem and/or (c) wait for #1529 to flip.
@therealkenc can confirm it has to do with things being open elsewhere in your system, a pernicious and consistently annoying issue in Windows in general. At first I thought it was the ongoing node processes I had running from dev servers (I'd close them with task manager) but my latest test seems to indicate my text editor is the culprit, using Sublime Text 3. When I close it I can install modules normally.
Even adding node_modules
directory to the folder_exclude_pattern
and binary_file_patterns
settings I still have the issue somehow. Perhaps Sublime's project implementation is touching the directories still? Not sure. Atom doesn't seem to have the same issue (but I decided against using it on Windows since it apparently can't do multi-line find replace. I just can't win[dows]!).
While trying to install a packge with npm (for example lodash) it fails with error message:
I have tried to install it both with and without starting bash in administrator mode.