How to fix 'Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
Solution 1:
- 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
bynpm i
Hope this might help.
Solution 2:
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:
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:
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.