Npm error unsupported platform for fsEvents when deploying to Azure

37,856

Solution 1

npm i -f doesn't sound like a good idea...

Instead, add fsevents to optional dependencies (if fsevents is in your package.json):

"optionalDependencies": {
    "fsevents": "^2.0.7"
}

Solution 2

@Aaron is correct. This was failing when I was running npm install from within maven-frontend-plugin.

I resolved the issue using the command npm i -f ( npm install forced)

Solution 3

fsevents is an OS X-only module, you can't install it on Windows.

Solution 4

fsevents is only needed if you are building on a Mac. If you are deploying to ubuntu, windows, etc it's not needed.

See here npm package.json OS specific dependency which reads,

npm package.json supports an os key,

and also optionalDependencies

os can be used to specify which OS a module can be installed on. optionalDependencies are module dependencies that if they cannot be installed, npm skips them and continues installing.

Either one will work. I prefer adding the following to my package.json's root object:

"optionalDependencies": {
    "fsevents": "^2.1.2",
  },

Solution 5

It is nothing to deal with Darwin or Windows . You might have installed the Angular but system variable path is not updated accordingly .

Get the ng install location from your system something like(C:\Users.....\AppData\Roaming\npm) and add at the end of system variable path .

now go to Cmd -> type ng-v for Angular 6 ( ng v or ng version for Angular 7 ).

Share:
37,856

Related videos on Youtube

Curious-programmer
Author by

Curious-programmer

Updated on July 31, 2022

Comments

  • Curious-programmer
    Curious-programmer almost 2 years

    When I run npm install, I get this error:

    npm ERR! code EBADPLATFORM npm ERR! notsup Unsupported platform for
    [email protected]: wanted {"os":"darwin","arch":"any"} (current:
    {"os":"win32","arch":"x64"}) npm ERR! notsup Valid OS:    darwin npm
    ERR! notsup Valid Arch:  any npm ERR! notsup Actual OS:   win32 npm
    ERR! notsup Actual Arch: x64
    

    This has been asked here but the accepted answer that it is optional does not work for me as I am unable to publish to azure since npm install fails.

    npm version : 5.6.0

    I have tried:

    npm install --no-optional
    
  • Curious-programmer
    Curious-programmer about 6 years
    @Aarob Chen How do I work around it? I don't know why it is attempting to install it?
  • Aaron Chen
    Aaron Chen about 6 years
    Have you checked @lacolaco‘s answers at this link: github.com/angular/angular/issues/13935?
  • Greg
    Greg over 4 years
    optionalDependencies works great for situations where you have multiple environments like developing on a Windows machine running Alpine or Centos Docker images to simulate production which is Linux. Each environment should be using its own node_modules directory though. Do not use bind mounts or copy node_modules, doing so will invite catastrophe into your deployments.
  • cwadrupldijjit
    cwadrupldijjit almost 3 years
    This answer is definitely true, but sometimes it's required farther down the dependency tree and NPM fails the install even though it's listed as an optional dependency. This, at least, is the case with the latest versions of NPM (v7+) and it seems to be a recurring problem through time since it was reported years ago, before the current major versions existed.
  • m3nda
    m3nda over 2 years
    This is a common, getting code compiled from another dev, then having node_modules and .lock files attached to it. If the prior dev installed modules i.e. from a Mac computer, then you can't work with them.