104

Testing binary Binary is fine npm WARN rollback Rolling back node-pre-gyp@0.12.0 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: fsevents@1.2.9 (node_modules\fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: 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

Jackson Chen
  • 111
  • 4
orcaenlhw
  • 1,143
  • 2
  • 7
  • 8
  • Does this answer your question? [Is there any way to get rid of npm optional dependency warnings through editing package.json?](https://stackoverflow.com/questions/50940423/is-there-any-way-to-get-rid-of-npm-optional-dependency-warnings-through-editing) – OrangeDog Aug 09 '20 at 16:05

14 Answers14

46
  • 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.

piet.t
  • 11,718
  • 21
  • 43
  • 52
SuperStar518
  • 2,814
  • 2
  • 20
  • 35
  • 3
    Working on an ubuntu virtual machine got the same error . npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS: darwin npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch: any npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS: linux – Koji D'infinte May 15 '19 at 15:24
  • 1
    @KojiD'infinte I've updated the answer. Plz check the PS: below. – SuperStar518 May 16 '19 at 02:07
  • 21
    the above won't help. `fsevents` is MacOS only package and this warning won't get away, even if you will remove node_modules folder and reinstall. In my application (vue.js v2.6), this fsevents is a depency from `fuse.js` which is used for whatever thing. I've just got used to these warnings. – Devtrix.net May 24 '19 at 11:07
  • 6
    > "If you're working on ubuntu or OS X, you won't face this issue, I guess." What? Ubuntu is Linux, not Darwin, of course you will face the same issue! – mastazi Jul 05 '20 at 04:59
  • 2
    I'm using Ubuntu 20.04 and the PS worked fine to me – tarcnux Mar 07 '21 at 08:43
  • 1
    Godddd, your answer has helped me a lot!!! Who could infer npm needed upgrade from a bare chokidar dep fuckup or something like that? Fortunately your answer crossed in my way and saved the evening before the demo I'm doing for a client. Just AFTER those step, I invoked [code] npm cache verify # again, now with npm upgraded, just in case... npm i --legacy-peer-deps # needed them from before, just in case [/code] And it worked like a charm for me. Now `npm run serve` worked again as it should always been. Thank you so much! – Noctumsempra Jun 04 '21 at 20:46
  • Be careful while suggesting to delete package-lock.json. Package-lock.json is auto-generated, yes, but it's the one responsible for the deterministic install of dependencies. Deleting it can cause some weird and undesired bugs in some cases. To remove it, for this error, does not make sense at all. – João Ignacio Oct 28 '21 at 13:30
29

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.

Victor Escalona
  • 545
  • 1
  • 6
  • 15
21

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.

wawan
  • 497
  • 6
  • 11
Ali Shan
  • 628
  • 5
  • 17
18

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.

Lin Du
  • 88,126
  • 95
  • 281
  • 483
rayrrr
  • 206
  • 2
  • 4
6

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.

Joel G Mathew
  • 7,561
  • 15
  • 54
  • 86
3

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.

andypotato
  • 703
  • 5
  • 10
2

I had the same issue:

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

viola, it worked for me

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 09 '21 at 01:49
2

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.

0

If you're seeing this error in a node Github workflow, you can update the runs-on value in node.js.yml to macos-latest and it will work. Worked for me anyways.

Cook88
  • 707
  • 1
  • 6
  • 18
0

The critical breakthrough for me was actually simple:

yarn remove fsevents

I verified that it worked by ctrl + f in yarn.lock for 'fsevents'. Before removing it, it appeared 9 times, after removing it, only 8. So I knew it had some effect.

Extra info

After removing fsevents:

git add .
git commit -m "Removed fsevents"
git push heroku master

and it worked.


Note that I also had to run bin/webpack-dev-server to see if the assets would precompile (better to try this locally where you can quickly address any deficiencies, rather than on heroku where it will take time to build).

I fixed any missing libraries with something like yarn add '@rails/activestorage' '@rails/ujs' etc, and when the app went to heroku it worked.

stevec
  • 41,291
  • 27
  • 223
  • 311
0

npm i work on dev machine, but fail on the CI pipeline.

The problem was the package-lock.json format version. On my dev machine, I have a most recent version of npm that on the CI machine. The recent npm version has generated a package-lock.json with lockfileVersion at 2 :

{
  "name": "MyAwesomeProject",
  "version": "1.0.0",
  "lockfileVersion": 2,
  "requires": true,
  "packages": {
    ...
  }
}

I removed package-lock.json from my repository and build CI worked.

vernou
  • 6,818
  • 5
  • 30
  • 58
0

I had to add webpack: ^5.87.0 to devDependencies in package.json. Then delete node_modules and package-lock.json, and in case npm cache clean --force and finally the npm install.

if you crawl up the package-lock.json, the module chain is as follows: fsevents => chokidar => watchpack => webpack. I did not need to add win32 to the arch targets

Julienm
  • 158
  • 1
  • 8
0

Try upgrading the node version to 8.5.0. Version >=8 suppresses this issue.

Shasna
  • 1
-10

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"}

  • 1
    My package.json don't have {"os":"darwin,linux","arch":"any"} but I still get the message npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) – Uri Gross May 04 '20 at 19:14