[node.js] How to fix 'fs: re-evaluating native module sources is not supported' - graceful-fs

Recently I've made a switch to Node v.6, and It started creating more and more problems with running normal builds grunt/gulp/webpack

For example:

$ gulp
[14:02:20] Local gulp not found in ~/_Other/angular-2-ts/angular2-seed
[14:02:20] Try running: npm install gulp

while gulp and all other plugins and modules are installed (and even re-installed via rm -rf node_modules) in /node_modules folder.

Most of those errors have line like

(node:42) fs: re-evaluating native module sources is not supported. 
If you are using the graceful-fs module, 
please update it to a more recent version.

with 42 as arbitrary number

Like in that issue I've submitted - in angular2-seed repo https://github.com/mgechev/angular2-seed/issues/902

What I've tried to do is downgrade to Node v.5 via n (https://www.npmjs.com/package/n) - it worked. Then remove all node_modules folders, then do

npm info graceful-fs -v
3.3.6

ok, lets upgrade or remove and install new:

npm i graceful-fs@latest
npm i [email protected]
sudo npm i [email protected] -g

all results in

npm info graceful-fs -v
3.3.6

So now I am currenlty stuck with graceful-fs 3.3.6 or even worse in some modules dependances, like

$ angular2-seed
$ npm install

//other lines..
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before 
will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 
as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.

What could be the strategy here:

  • Manually patch all the deps that contain graceful-fs < 4.0.0?
  • There's some global switch to use specific package version?
  • Reinstall everything?

This question is related to node.js npm node-modules npm-install

The answer is


I was able to fix it by:

  1. updating by package.json
  2. deleting the node_modules folder
  3. executing npm install

Or try to update node:

brew upgrade node

If it is installed with brew (like in my case). sudo npm update -g npm did not solve the "same" problem for me.


In the case of my Cordova-project, uninstalling and installing cordova -g fixed the problem for me.

npm uninstall -g cordova
npm install -g cordova

Deleting node_modules folder contents and running

npm install bower
npm install

solved the problem for me!


if you are running nvm you might want to run nvm use <desired-node-version> This keeps node consistent with npm


As described here, you can also attempt the command

npm cache clean

That fixed it for me, after the other steps had not fully yielded results (other than updating everything).


The report says : a file is missing in ... vendor/win32-x64-48/binding.node

I looked for the binding.node file and I find it in...

https://github.com/sass/node-sass-binaries

Copy the correct file with the name binding.node and it works.


Just to point out that cordova brings in it's own npm with the graceful-fs dependency, so if you use Cordova make sure that it is the latest so you get the latest graceful-fs from that as well.


Solved this bug with reinstall gulp

npm uninstall gulp
npm install gulp

Type npm list graceful-fs and you will see which versions of graceful-fs are currently installed.

In my case I got:

npm list graceful-fs

@request/[email protected] /projects/request/promise-core
+-- [email protected]
| `-- [email protected]
|   +-- [email protected]
|   | `-- [email protected]
|   |   `-- [email protected]
|   |     `-- [email protected]
|   |       `-- [email protected]        <==== !!!
|   `-- [email protected] 
`-- [email protected]
  +-- [email protected]
  | `-- [email protected]
  |   `-- [email protected]
  |     `-- [email protected]
  |       `-- [email protected] 
  `-- [email protected]
    `-- [email protected]
      `-- [email protected]

As you can see gulp deep down depends on a very old version. Unfortunately, I can't update that myself using npm update graceful-fs. gulp would need to update their dependencies. So if you have a case like this you are out of luck. But you may open an issue for the project with the old dependency - i.e. gulp.


Examples related to node.js

Hide Signs that Meteor.js was Used Querying date field in MongoDB with Mongoose SyntaxError: Cannot use import statement outside a module Server Discovery And Monitoring engine is deprecated How to fix ReferenceError: primordials is not defined in node UnhandledPromiseRejectionWarning: This error originated either by throwing inside of an async function without a catch block dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac internal/modules/cjs/loader.js:582 throw err DeprecationWarning: Buffer() is deprecated due to security and usability issues when I move my script to another server Please run `npm cache clean`

Examples related to npm

What does 'x packages are looking for funding' mean when running `npm install`? error: This is probably not a problem with npm. There is likely additional logging output above Module not found: Error: Can't resolve 'core-js/es6' Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist` ERROR in The Angular Compiler requires TypeScript >=3.1.1 and <3.2.0 but 3.2.1 was found instead DeprecationWarning: Buffer() is deprecated due to security and usability issues when I move my script to another server Please run `npm cache clean` What exactly is the 'react-scripts start' command? On npm install: Unhandled rejection Error: EACCES: permission denied Difference between npx and npm?

Examples related to node-modules

SyntaxError: Cannot use import statement outside a module What could cause an error related to npm not being able to find a file? No contents in my node_modules subfolder. Why is that? Node - was compiled against a different Node.js version using NODE_MODULE_VERSION 51 npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Nuwanst\package.json' Cannot find the '@angular/common/http' module How to use paths in tsconfig.json? Could not find a declaration file for module 'module-name'. '/path/to/module-name.js' implicitly has an 'any' type How to fix 'fs: re-evaluating native module sources is not supported' - graceful-fs How to provide a mysql database connection in single file in nodejs Git - Ignore node_modules folder everywhere

Examples related to npm-install

How to update core-js to core-js@3 dependency? Can not find module “@angular-devkit/build-angular” How do I deal with installing peer dependencies in Angular CLI? NPM Install Error:Unexpected end of JSON input while parsing near '...nt-webpack-plugin":"0' How to solve npm install throwing fsevents warning on non-MAC OS? Why does "npm install" rewrite package-lock.json? What is the difference between npm install and npm run build? How to solve npm error "npm ERR! code ELIFECYCLE" base 64 encode and decode a string in angular (2+) Install specific branch from github using Npm