Preact-cli: npm install EPERM error (errno: -4048)

Created on 11 Aug 2017  路  40Comments  路  Source: preactjs/preact-cli


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

Most helpful comment

I have problem on v5.3.0.
Update to v5.5.1 - problem still exsist.
Downgrade to 5.0.0 - problem is gone.

All 40 comments

@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.

I have problem on v5.3.0.
Update to v5.5.1 - problem still exsist.
Downgrade to 5.0.0 - problem is gone.

Confirming what @fffixed said, it's still here with [email protected]

I still use 5.0.3. No problem with this version. I upgraded to 5.4.2 once it was released. Problem still lingered, so switched back to 5.0.3.

I installed 5.5.1 and the problem exists. Downgrading to 5.0.3 removed the issue.

@nemoxps I am facing the same issue with downgrading. How did you get past that error and downgrade your npm?

@saip106

  1. Create a new directory (let's call it _npm).
  2. Move both npm files from your <Node> directory to _npm.
  3. Create a node_modules directory in _npm.
  4. Move the npm directory from <Node>/node_modules to _npm/node_modules.
  5. Navigate your command prompt to _npm and type npm install -g [email protected].
  6. Finally you can delete _npm.

Try npm cache verify with npm 5.6.0+

just reinstall node js .

I've came across the same issue on our windows build server.

Long search, short answer: Some npm version seem to have issues with race-conditions on OS detection. Sometimes it works, sometimes not.

In the end, I upgraded npm from 5.5.1 to 5.6.0. This version seems to run stable on windows.
Don't forget to add the "--no-optional" option.

Same issue, the problem was my anit-ransomware was cockblocking as usual

Downgrading worked for me too.Thanks Guys.

npm install -g [email protected]

Downgrading to 5.0.3 worked for me. Thanks! <3

Well all i had to do was restart my computer and everything worked fine. My NPM version is 6.5.0

For anyone wondering how to solve this(on Windows):

  1. Run cmd as Admin
  2. Run command for installation (npm install )
  3. Watch where it breaks (on witch package), in my case it was rxjs and lodash, but I was trying to install @angular /cli. You will have to do this few times probably. For me it broke 2 times, once for rxjs, second time for lodash.
  4. Install each problematic package manually (so, in my exaple it was rxjs and lodash)
  5. Repeat step 2. It should be fine now.

Hope this helps somebody.
Best regards..

EDIT:
Also, use Node.js command prompt(not Windows cmd!), and do npm cache verify often..

Screenshot (38) @LCvijovic09 I am getting this

@skshitalkekan that means that you don't have Angular intalled or you dont have ng registered in your Enviroment Variables. Try with "npm ng -v".

Good luck.
Regards,
Lazar

@LCvijovic09 I tried npm ng -v and got version as 6.14.4 ,do I need to use npm ng every time like for creating and serv project

@skshitalkekan that means you have Angular installed but you need to register ng.exe in you Enviroment Variables on Windows. Google it out, I think it will be easy enough to find. :)

and to answer your questio, in the current setup you have, yes you will need to run "npm ng" for everything you want to run using "ng" command. Example: "npm ng g c ..." to create components for example..

I have problem on v5.3.0.
Update to v5.5.1 - problem still exsist.
Downgrade to 5.0.0 - problem is gone.

Thank you
Past 2 weeks I almost tried every fix none of them were working at last my problem get fixed by your suggestion awesome thanks man

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zwrawr picture zwrawr  路  3Comments

yoshiwarab picture yoshiwarab  路  3Comments

thangngoc89 picture thangngoc89  路  3Comments

jpoo90 picture jpoo90  路  4Comments

haggen picture haggen  路  3Comments