npm install EPERM error (errno: -4048)
Do you want to request a feature or report a bug? Report a bug.
What is the current behavior?
I'm trying to install preact-cli but I'm getting an error. This is at the end of the npm log:
31022 silly lifecycle [email protected]~postinstall: Returned: code: 0 signal: null
31023 verbose unlock done using <lockPath>.lock for C:\Node\node_modules\.staging
31024 verbose stack Error: EPERM: operation not permitted, lstat 'C:\Node\node_modules\preact-cli\node_modules\fsevents\node_modules\dashdash\node_modules'
31025 verbose cwd C:\Users\nemoxps
31026 verbose Windows_NT 6.1.7601
31027 verbose argv "C:\\Node\\node.exe" "C:\\Node\\node_modules\\npm\\bin\\npm-cli.js" "i" "-g" "preact-cli"
31028 verbose node v8.2.1
31029 verbose npm v5.3.0
31030 error path C:\Node\node_modules\preact-cli\node_modules\fsevents\node_modules\dashdash\node_modules
31031 error code EPERM
31032 error errno -4048
31033 error syscall lstat
31034 error Error: EPERM: operation not permitted, lstat 'C:\Node\node_modules\preact-cli\node_modules\fsevents\node_modules\dashdash\node_modules'
31034 error { Error: EPERM: operation not permitted, lstat 'C:\Node\node_modules\preact-cli\node_modules\fsevents\node_modules\dashdash\node_modules'
31034 error stack: 'Error: EPERM: operation not permitted, lstat \'C:\\Node\\node_modules\\preact-cli\\node_modules\\fsevents\\node_modules\\dashdash\\node_modules\'',
31034 error errno: -4048,
31034 error code: 'EPERM',
31034 error syscall: 'lstat',
31034 error path: 'C:\\Node\\node_modules\\preact-cli\\node_modules\\fsevents\\node_modules\\dashdash\\node_modules' }
31035 error Please try running this command again as root/Administrator.
31036 verbose exit [ -4048, true ]
This error appears even if I run this as root. I looked into C:\Node\node_modules\preact-cli\node_modules and there isn't a folder called fsevents.
If I run $ preact create example I'm getting this: Installing dev dependenciesError: Exited with status 1
Any ideas how to fix that?
If the current behavior is a bug, please provide the steps to reproduce.
$ npm i -g preact-cli
@nemoxps can you provide the node version and such details?
Please fill the required fields in the issue template next time :)
Oh, I thought it would be fine as you can find it in the npm log.
- Node: v8.2.1
- npm: v5.3.0
- OS: Windows 7
oh didn't see that part 😅
@nemoxps this is a permission issue. Install it with Administrator permission
I did. I right-clicked that cmd icon and clicked Run as administrator, entered the administrator password and typed npm i -g preact-cli. Windows drives me mad...
It's highly advice that you configure npm to not require sudo/Admin permission to install global packages
Uhh, do you mind to share a link on how I'm supposed to do so?
I don't know how to do it for Windows. But on *nix, I use nvm. There is a nvm port for Windows so you could try that
Okay, then I'll give nvm-windows a shot.
It just don't want to work, no matter what I try.
4172 silly lifecycle [email protected]~postinstall: Returned: code: 0 signal: null
4173 verbose unlock done using <lockPath>.lock for C:\Program Files\nodejs\node_modules\.staging
4174 verbose stack Error: EPERM: operation not permitted, lstat 'C:\Program Files\nodejs\node_modules\preact-cli\node_modules\fsevents\node_modules\getpass\node_modules'
4175 verbose cwd C:\Users\nemoxps
4176 verbose Windows_NT 6.1.7601
4177 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "-g" "preact-cli"
4178 verbose node v8.3.0
4179 verbose npm v5.3.0
4180 error path C:\Program Files\nodejs\node_modules\preact-cli\node_modules\fsevents\node_modules\getpass\node_modules
4181 error code EPERM
4182 error errno -4048
4183 error syscall lstat
4184 error Error: EPERM: operation not permitted, lstat 'C:\Program Files\nodejs\node_modules\preact-cli\node_modules\fsevents\node_modules\getpass\node_modules'
4184 error { Error: EPERM: operation not permitted, lstat 'C:\Program Files\nodejs\node_modules\preact-cli\node_modules\fsevents\node_modules\getpass\node_modules'
4184 error stack: 'Error: EPERM: operation not permitted, lstat \'C:\\Program Files\\nodejs\\node_modules\\preact-cli\\node_modules\\fsevents\\node_modules\\getpass\\node_modules\'',
4184 error errno: -4048,
4184 error code: 'EPERM',
4184 error syscall: 'lstat',
4184 error path: 'C:\\Program Files\\nodejs\\node_modules\\preact-cli\\node_modules\\fsevents\\node_modules\\getpass\\node_modules' }
4185 error Please try running this command again as root/Administrator.
4186 verbose exit [ -4048, true ]
fsevents blows it up, again and again. EPERM when I'm root... I just don't get it.
Hey @nemoxps, this seems to be a problem in npm itself.. https://github.com/npm/npm/issues/17671
As far as I can tell the only fix at this moment is to revert back to a npm version that still works and install it that way.. (It seems like 5.0.4 should still work on Windows)
@rijkvanzanten Thanks a bunch! That's the real issue. Downgrading to [email protected] works for me. Though, trying to downgrade was a bit weird:
λ npm install -g [email protected]
npm ERR! path C:\Node\npm.cmd
npm ERR! code EEXIST
npm ERR! Refusing to delete C:\Node\npm.cmd: is outside C:\Node\node_modules\npm and not a link
npm ERR! File exists: C:\Node\npm.cmd
npm ERR! Move it away, and try again.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\nemoxps\AppData\Roaming\npm-cache\_logs\2017-08-12T15_20_25_184Z-debug.log
Anyway, thanks for helping, guys!
Downgrading worked. Thank you guys!!!!!!!
Thanks. It also worked for me. I downgraded my npm version to 5.3.0
For all the people who are facing the same issue, it has been resolved by npm in the latest version.
I actually installed 5.4.1 today, and now I get this issue :( I never had this problem before, and never had to use cmd as administrator. Tried it thought, and still nothing.
Downgrading to v5.3.0 did not work for me. Then I downgraded to v5.0.3 as @nemoxps mentioned. Now it works fine.
@SvetaSR @techboy-zero , upgrade npm version to 5.4.2 it will fix your problem. my issues fixed with the same.
@babusurendra Thanks for the response. I upgraded npm version to 5.4.2 right after it's release. And till now I have not faced any problem.
Same issue for me on npm v5.4.2.