How to fix 'Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

Ionic FrameworkNpm

Ionic Framework Problem Overview


Testing binary Binary is fine npm WARN rollback Rolling back [email protected] failed (this is probably harmless):

> EPERM: operation not permitted, lstat 'C:\Users\orca > yoon\Documents\IonicProjects\starters\epic\node_modules\fsevents\node_modules' > > npm notice created a lockfile as package-lock.json. You should commit > this file. > > npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] > (node_modules\fsevents): > > npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform > for [email protected]: wanted {"os":"darwin","arch":"any"} (current: > {"os":"win32","arch":"x64"})

added 1105 packages from 1050 contributors and audited 53269 packages in 445.94s found 1 high severity vulnerability run npm audit fix to fix them, or npm audit for details

Ionic Framework Solutions


Solution 1 - Ionic Framework

  • First,

Run your command prompt or powershell as Administrator role. Then you'll get avoided with PERMISSION ERROR.

  • Second,

Ignore npm audit fix. It only suggests you to renovate all of your package.json dependencies up-to-date. You should preserve the settings clarified in package.json.

  • Third,

If you're working on ubuntu or OS X, you won't face this issue, I guess.


PS:

According to your reply, I'd like to think about the workaround.

  • Remove the local node_modules & package-lock.json
  • Clean npm cache by npm cache verify
  • Update the global npm by sudo npm i -g npm
  • Reinstall the local node_modules by npm i

Hope this might help.

Solution 2 - Ionic Framework

When seeing this kind of message on ionic or anywhere else, do run npm audit fix and see if you can successfully follow the given advice to resolve all "high severity vulnerability" issues and contribute the resulting updated dependencies back to the given codebase.

What's happening here is that a package called chokidar is being used to "watch" filesystem directories for "events" (like files being added). chokidar is a wrapper for Linux-, Windows-, and Mac-specific filesystem-watching packages, of which fsevents is the Mac variant. So, I am pretty sure anything that uses chokidar is going to have fsevents as an optional dependency, but as others have said, this WARN message can be safely ignored, as chokidar supports all common desktop architectures.

Solution 3 - Ionic Framework

I found a solution, this is what I did:

Open your package-lock.json.

Find node_modules/fsevents, inside this there is something called "os", I had only this:

 "os": [
        "darwin",
      ],

So my OS is windows 10 64 bits I just added my OS inside "os", the result is this:

 "os": [
        "darwin",
        "win32"
      ],

then save and is solved, after doing this I could install the package I was trying to install that I couldn't.

Solution 4 - Ionic Framework

As I got into the issue just today I read the first solution but tried one thing first

Remove package-lock.json and node_modules dir first

Run these commands and it should work.

rm -rf node_modules package-lock.json
npm install

worked like a charm maybe it'll help someone else.

Solution 5 - Ionic Framework

If like me, you got this issue because of using two different package managers at the same time (E.g. yarn and npm), you can simply remove the lockfile and rerun your package manager.

rm package-lock.json

The lockfile will be regenerated the next time you run your package manager. I got this error while trying to upgrade the packages with npm upgrade. After deleting the lockfile, upgrade proceeded smoothly and the lockfile was created correctly.

Solution 6 - Ionic Framework

This warning will appear if you added IOS as platform to your project and run npm i on Windows or Linux. As you can't build IOS packages on these systems anyway you can safely ignore this warning.

Solution 7 - Ionic Framework

I had the same issue:

  1. Deleted package-lock.json
  2. npm install

viola, it worked for me

Solution 8 - Ionic Framework

After opening the command prompt or PowerShell in the administrator mode, what helped me was following this answer here.

I ran the command: npm i --force and that seemed to fix the issue.

Solution 9 - Ionic Framework

You have to add win64 on package.json file

For example

{"os":"darwin,linux","arch":"any"} will replace with

{"os":"darwin,linux,win32,win64","arch":"any"}

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiontheednorcView Question on Stackoverflow
Solution 1 - Ionic Frameworkegor518View Answer on Stackoverflow
Solution 2 - Ionic FrameworkrayrrrView Answer on Stackoverflow
Solution 3 - Ionic FrameworkVictor EscalonaView Answer on Stackoverflow
Solution 4 - Ionic FrameworkAli ShanView Answer on Stackoverflow
Solution 5 - Ionic FrameworkJoel G MathewView Answer on Stackoverflow
Solution 6 - Ionic FrameworkandypotatoView Answer on Stackoverflow
Solution 7 - Ionic FrameworkKomiljon AliyevView Answer on Stackoverflow
Solution 8 - Ionic FrameworkShirin KaulView Answer on Stackoverflow
Solution 9 - Ionic FrameworkTech DevilsView Answer on Stackoverflow