preact-cli: 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 preact-cli@1.4.1~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

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 40 (3 by maintainers)

Most upvoted comments

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

@rijkvanzanten Thanks a bunch! That’s the real issue. Downgrading to npm@5.0.3 works for me. Though, trying to downgrade was a bit weird:

λ npm install -g npm@5.0.3
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!

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)

@nemoxps this is a permission issue. Install it with Administrator permission

Downgrading worked for me too.Thanks Guys.

npm install -g npm@5.0.3

Confirming what @fffixed said, it’s still here with npm@5.5.1

Try npm cache verify with npm 5.6.0+

Downgrading worked. Thank you guys!!!

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

  1. Run cmd as Admin
  2. Run command for installation (npm install <package-name>)
  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…

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

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.

@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 npm@5.0.3.
  6. Finally you can delete _npm.

It just don’t want to work, no matter what I try.

4172 silly lifecycle preact-cli@1.4.1~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.

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…