162

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 graceful-fs@4.1.4
sudo npm i graceful-fs@4.1.4 -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 graceful-fs@1.2.3: 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?
see sharper
  • 11,505
  • 8
  • 46
  • 65
shershen
  • 9,875
  • 11
  • 39
  • 60
  • I am having same issue with Gulp and some of my modules. I fixed my modules by upgrading the modules to use the latest graceful-fs, but I am not sure there is a solution to fix other modules that have not upgraded yet. – Jeremy Chone May 20 '16 at 17:01
  • Looks like this won't be fixed in Gulp 3.x and you will have to upgrade to Gulp 4.x https://github.com/gulpjs/gulp/issues/1571 – dtothefp Jun 01 '16 at 18:18

11 Answers11

170

I had this problem and I was able to fix this by updating npm

sudo npm update -g npm

Before the update, the result of npm info graceful-fs | grep 'version:' was:

version: '3.3.12'

After the update the result is:

version: '3.9.3'
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Asimov
  • 1,855
  • 1
  • 12
  • 8
  • Thanks @Jorge. This helped fix the problem. I am still getting appname@0.1.x /path/of/app with graceful-fs@4.1.4 highlighted every time I run npm install in my app directory. but I am living with that for now. – Geo May 30 '16 at 21:48
  • Hi @Geo, same here, look at the answer by analog-nico, we have different versions of the same package because other tools depend strictly on those versions. To get rid of the warning we need to upgrade all of them or look for replacements. – Asimov Jun 02 '16 at 23:11
  • 5
    This didn't work for me, I had to run `nvm use v6.2.1` – nicmwenda Jun 15 '16 at 14:22
  • 46
    Please note that `npm info graceful-fs -v` returns the version of npm (it is the same as running `npm -v`) and NOT graceful-fs. To get graceful-fs version, use something like `npm info graceful-fs | grep version:`. – nstCactus Jul 17 '16 at 18:29
  • 6
    @Asimov This worked for me too. Also, if you reinstalled NodeJS recently (I installed Node through the package on their website and then replaced it with the one from homebrew) run `rm -rf node_modules && npm install` in the project home folder. – Dylanthepiguy Aug 31 '16 at 23:43
  • @nstCactus do you know where that's looking? Running your command gives me **4.1.6**, but running the command from analog-nico ([below](http://stackoverflow.com/a/37470253/1241736)) shows me **4.1.4** in gulp-util@3.0.7, and **1.2.3 and 3.0.8** in vinyl-fs (fwiw this is node 6.3.1 via nvm) – henry Sep 03 '16 at 17:59
73

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/promise-core@0.0.1 /projects/request/promise-core
+-- gulp@3.9.1
| `-- vinyl-fs@0.3.14
|   +-- glob-watcher@0.0.6
|   | `-- gaze@0.5.2
|   |   `-- globule@0.1.0
|   |     `-- glob@3.1.21
|   |       `-- graceful-fs@1.2.3        <==== !!!
|   `-- graceful-fs@3.0.8 
`-- publish-please@2.1.3
  +-- nsp@2.4.0
  | `-- nodesecurity-npm-utils@4.0.1
  |   `-- silent-npm-registry-client@2.0.0
  |     `-- npm-registry-client@7.1.0
  |       `-- graceful-fs@4.1.3 
  `-- read-pkg@1.1.0
    `-- load-json-file@1.1.0
      `-- graceful-fs@4.1.4

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.

analog-nico
  • 2,750
  • 17
  • 25
  • 13
    FYI, in your specific example, `gulp` won't change it in version 3 but only in version 4: https://github.com/gulpjs/gulp/issues/1571 – JBE Jun 22 '16 at 17:09
  • 2
    this was it for me, final push to remove gulp – Darko Aug 18 '16 at 06:47
  • In my case, the pre-v4 `graceful-fs` module dependency was coming from `npm` itself (version 3.10.3) via `cmd-shim@2.0.2`. I didn't see this until I listed the _global_ `graceful-fs` dependencies using `npm list -g graceful-fs`. – Rusty Shackleford Sep 20 '16 at 18:40
  • This helped me solve it. My graceful-fs package was up-to-date, but a few other packages still relied on an older version. – Jelle De Loecker Oct 13 '16 at 13:56
21

Solved this bug with reinstall gulp

npm uninstall gulp
npm install gulp
Hamza Erbay
  • 446
  • 4
  • 10
1

Deleting node_modules folder contents and running

npm install bower
npm install

solved the problem for me!

David
  • 21
  • 1
  • 6
1

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).

Community
  • 1
  • 1
serv-inc
  • 35,772
  • 9
  • 166
  • 188
1

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.

Yohio
  • 119
  • 10
1

I was able to fix it by:

  1. updating by package.json
  2. deleting the node_modules folder
  3. executing npm install
szuuuken
  • 896
  • 10
  • 12
0

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

nicmwenda
  • 139
  • 1
  • 3
0

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.

Aziz Alto
  • 19,057
  • 5
  • 77
  • 60
0

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.

David H
  • 25
  • 1
  • 4
0

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
Magnus Ingwersen
  • 374
  • 3
  • 11