Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fsevents to NodeJS #7858

Closed
clavecoder opened this issue Jul 24, 2016 · 24 comments
Closed

Add fsevents to NodeJS #7858

clavecoder opened this issue Jul 24, 2016 · 24 comments
Labels
feature request Issues that request new features to be added to Node.js. fs Issues and PRs related to the fs subsystem / file system. libuv Issues and PRs related to the libuv dependency or the uv binding. macos Issues and PRs related to the macOS platform / OSX.

Comments

@clavecoder
Copy link

clavecoder commented Jul 24, 2016

  • Version: 6.x
  • Platform: Linux
  • Subsystem: Ubuntu

Suggestion

Add a normalized native interface for fsevents and chokidar so that optional dependencies can be avoided on development oriented packages and to improve development package workflow.

Details

Non non-IOS platforms, many development packages installed through npm result in the warning:

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14

The instructions for contributing to the popular Angular 2 project states:

To add a new dependency do the following:

  1. if you are on linux or windows, then use MacOS or ask someone with MacOS to perform the installation. This is due to an optional fsevents dependency that is really required on MacOS to get good performance from file watching.

npm-shrinkwrap.readme.md

It seems to be a rather dubious workflow that's made necessary by the lack of an efficient native file watch capability in node. If NodeJs supplied a normalized fast directory watcher directly, there would be no need for these gymnastics.

Prior Art

  • fsevents: Native access to OS X FSEvents in Node.js
  • chokidar: A neat wrapper around node.js fs.watch / fs.watchFile / fsevents.
@mscdex mscdex added fs Issues and PRs related to the fs subsystem / file system. feature request Issues that request new features to be added to Node.js. macos Issues and PRs related to the macOS platform / OSX. labels Jul 24, 2016
@ChALkeR
Copy link
Member

ChALkeR commented Jul 24, 2016

/cc @saghul, perhaps?

@ChALkeR ChALkeR added the libuv Issues and PRs related to the libuv dependency or the uv binding. label Jul 24, 2016
@MylesBorins
Copy link
Contributor

MylesBorins commented Jul 24, 2016

For context, fsevents is primarily used for non poll based file watching on OSX, as it is not supported by default. It is maintained by strongloop and has an MIT license.

I have been individually interested in improving the Node.js file watching story for a minute, and would be interested in exploring this if we decide it is something that we want to include in the platform.

as I think @ChALkeR is hinting at this would most likely be implemented in libuv and in turn floated up to node (potentially without any change to Node interfaces).

@saghul can you give us a bit of an insight into the current OSX filewatching story in libuv and why the hooks into Core Services are not currently implemented?

@bnoordhuis
Copy link
Member

Libuv uses FSEvents (the platform API, not the npm module) internally but it (and therefore node) presents a largest common denominator API, meaning it provides the most consistent cross-platform API that is possible with something as platform-specific as file watching.

In short, libuv works this way for a reason and won't change. If you want something more full-featured, use the relevant npm module.

@saghul
Copy link
Member

saghul commented Jul 25, 2016

Ben said it all :-) We do however, have some features that are supported on some backends but not in others: recursive file watching, for instance.

As for the warning: IMHO there should be no warning printed if an optional dependency doesn't apply to the current OS, but that's an npm thing.

@clavecoder
Copy link
Author

But what about the development workflow issue? If so many fundamental tools require the use of fsevents, must we mandate that all teams npm install from mac's so that dependencies are set up correctly as the angular team has had to do? I think there is a hole there. "Node thing/npm thing" I don't think captures the spirit of node development. Node would not be very important without npm and much of node's ubiquity is due to the web tool chain based on node. So I think there are several developer user stories that merit looking at supporting something beyond a "least common denominator" implementation.

@saghul
Copy link
Member

saghul commented Jul 25, 2016

My reply was to the warning part. As for the workflow part, given that fsevents is already a dependency of the projects which use it and it's installed on the appropriate OS when needed without user interaction (other than npm install, which has to be done anyway) I fail to see how bundling fsevents solves anything. It saves users from downloading a package, which I think it's a smaller deal compared to the cost of the maintenance of adding the module to core.

Or maybe I misunderstood your point. Maybe you can rephrase / elaborate? As in, what is the problem with having those optional dependencies?

@clavecoder
Copy link
Author

The workflow issue is for the developers of a development tool, not it's users. The instructions given by the Angular team is necessary for any development package that supports a watch function.

From my suggestion above:

The instructions for contributing to the popular Angular 2 project states:

To add a new dependency do the following:

  1. if you are on linux or windows, then use MacOS or ask someone with MacOS to perform the installation. This is due to an optional fsevents dependency that is really required on MacOS to get good performance from file watching.

npm-shrinkwrap.readme.md

It seems rather silly that if you are using Windows or Linux, you would need to ask a MacOS user to npm install --save-dev but, apparently, it ensures that dependencies are managed appropriately.

@bnoordhuis
Copy link
Member

fsevents (the module) ships pre-compiled binaries by means of node-pre-gyp. It's possible to do the packaging on non-OS X but you may have to jump through a few hoops to pacify npm shrinkwrap. That's more of a papercut issue and not really a concern of node core, though.

@clavecoder
Copy link
Author

OK. So the issue could be solved by changing the fsevents package, itself, right? Seems reasonable. Anywhere you can point me how "pacify npm shrinkwrap can be done, or is that an NPM question...

@bnoordhuis
Copy link
Member

I'd say that's more of an npm question. In the past I've used preshrinkwrap scripts for downloading binaries and that worked quite well but better solutions may exist.

@Dzhakhar
Copy link

For this reason ee-first module also doesn't work.

@Jorg71
Copy link

Jorg71 commented Aug 7, 2016

What is the solution for Windows-users?

@clavecoder
Copy link
Author

clavecoder commented Aug 7, 2016

chokidar, I believe. And it seem that its is what has the optional include for fsevents, so the "warning" happens indirectly. It appears that it covers all three platforms without doing "lowest common denominator".

@Jorg71
Copy link

Jorg71 commented Aug 7, 2016

My OS is Windows 10. I tried to install chokidar via "npm install chokidar", but get some warnings:

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\jh\package.json'
npm WARN jh No description
npm WARN jh No repository field.
npm WARN jh No README data
npm WARN jh No license field.

@clavecoder
Copy link
Author

clavecoder commented Aug 8, 2016

Yeah, uh, that's what this thread is all about. The warning should probably be an info. Ignore the error it's supposed to work that way. The optional dependency is needed only on OSX systems to get decent performance. It's not needed on Windows or Linux, so no need to worry. It's just something that we all have to learn.

@Jorg71
Copy link

Jorg71 commented Aug 8, 2016

Warnings and errors that much are'nt familiar to me. Mostly I've been working in the Microsoft / Windows / Database / Desktop world in the last 20 years. Most of the development tools in this world are elaborated and stable because of their longevity. But the Google / Angular / Firebase world is much more fascinating and seems to be the technology leader in the near future. Let's go on trying and learning :-)

@clavecoder
Copy link
Author

clavecoder commented Aug 8, 2016

Yeah, I call it Google Driven Development (GDD) — and I'm speaking of the search engine, not the stack. You will soon become a Full StackOverflow Developer. Finally you will develop JavaScript Fatigue, and want to chuck it. But you, as a professional devloper with mouths to feed, will soldier on and finally develop JavaScript-Fatigue fatigue, decide to know what you know, and get the job done. It's the next generation's crazy world. I'm just trying to feed my family in it.

@Jorg71
Copy link

Jorg71 commented Aug 8, 2016

Yeah. That's the other side: Develop yourself and your skills by moving to Google. I moved from Microsoft to Google because Microsoft is always saying "you can't do this, you can't do that because of security, security, security." And if you find a way to do what you want, you will be stopped 5 months later by security updates. With angular it's like running against the wall several times, then breaking it. After that you find yourself in a labyrinth of packages and modules that is changing every day. It's fascinating.

@DivyaPoornam91
Copy link

Hi getting error while installing npm

C:\Users\DivyaP>npm install fsevents
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "fsevents"
npm ERR! node v6.6.0
npm ERR! npm v3.10.3
npm ERR! code EBADPLATFORM

npm ERR! notsup Not compatible with your operating system or architecture: fsevents@1.0.14
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: win32
npm ERR! notsup Actual Arch: x64

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\DivyaP\npm-debug.log

Please advice.

@saghul
Copy link
Member

saghul commented Sep 19, 2016

fsevents is only compatible with OSX. It's specific to that platform, so it
won't work on Windows.

On Sep 19, 2016 08:04, "DivyaPoornam91" notifications@github.com wrote:

Hi getting error while installing npm

C:\Users\DivyaP>npm install fsevents
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program
Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "fsevents"
npm ERR! node v6.6.0
npm ERR! npm v3.10.3
npm ERR! code EBADPLATFORM

npm ERR! notsup Not compatible with your operating system or architecture:
fsevents@1.0.14
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: win32
npm ERR! notsup Actual Arch: x64

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\DivyaP\npm-debug.log

Please advice.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#7858 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AATYGIuiXgMTeULIgBRUJND4xa6Ab7KHks5qrjQPgaJpZM4JTeTL
.

@hdave
Copy link

hdave commented Oct 5, 2016

Every time I am told "Ignore this warning" a get a bad feeling in my stomach. Fact is, architecture dependent dependencies should either be ignored or throw an ERROR on unsupported architectures. Java/Maven has had this for 9 years....npm should have it too.

@xgqfrms-GitHub
Copy link

xgqfrms-GitHub commented Nov 5, 2016

npm fsevents install error!
npm fsevents install error

@proehlen
Copy link

@clavecoder Is there a reason this issue was closed? I can ignore the warning but being spammed with it every time I run npm means I'll tend to miss / ignore legitimate warnings.

@saghul
Copy link
Member

saghul commented Dec 21, 2016

@proehlen There is nothing Node can fix here AFAIK. It's npm which should fail more gracefully if the user tries to install a package in an unsupported platform, I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. fs Issues and PRs related to the fs subsystem / file system. libuv Issues and PRs related to the libuv dependency or the uv binding. macos Issues and PRs related to the macOS platform / OSX.
Projects
None yet
Development

No branches or pull requests