42

I'm getting this error when I try to run the command gulp watch-bs for my UnderStrap child theme for WordPress. I've been using this command for a year with no problems, but I received this error today when I updated my node and npm to their latest versions.

ReferenceError: internalBinding is not defined
    at internal/util/inspect.js:31:15
    at req_ (C:\xampp\htdocs\node_modules\natives\index.js:137:5)
    at require (C:\xampp\htdocs\node_modules\natives\index.js:110:12)
    at util.js:25:21
    at req_ (C:\xampp\htdocs\node_modules\natives\index.js:137:5)
    at require (C:\xampp\htdocs\node_modules\natives\index.js:110:12)
    at fs.js:42:21
    at req_ (C:\xampp\htdocs\node_modules\natives\index.js:137:5)
    at Object.req [as require] (C:\xampp\htdocs\node_modules\natives\index.js:54:10)
    at Object.<anonymous> (C:\xampp\htdocs\node_modules\vinyl-fs\node_modules\graceful-fs\fs.js:1:99)

I've read here that, in order to resolve the issue, I need to run this command:

npm install natives@1.1.6

but this did not help resolve the issue.

Am I missing something else?

A-Sharabiani
  • 17,750
  • 17
  • 113
  • 128
Student22
  • 1,979
  • 5
  • 22
  • 33

8 Answers8

77

I ran into the same issue as you. To fix it, I added the following to my package.json in the devDependencies section

"natives": "^1.1.6"
Lloyd Smith
  • 1,187
  • 12
  • 21
  • 1
    Thanks for your reply, Lloyd. I checked my `package.json` file and I can't see a `devDependencies` object anywhere in the file. However, I do have a `dependencies` object with `"natives": "^1.1.6"` as one of its properties. Do I need to run a command in order to have `devDependencies`? Thanks! – Student22 Jan 31 '19 at 05:28
  • In your package.json, you can just add the devDependencies section. https://npm.github.io/using-pkgs-docs/package-json/types/devdependencies.html – Lloyd Smith Feb 01 '19 at 14:44
  • Works fine! Thanks a lot – Beto Silva Sep 13 '19 at 20:08
  • 3
    Any comment on this warn from npm: "npm WARN deprecated natives@1.1.6: This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.". Should the solution be to install graceful-fs@4.x? – Kat Lim Ruiz Sep 24 '19 at 14:53
  • Working fine!! Thanks – Siddharth Vyas Jan 08 '20 at 09:12
  • 1
    Make sure to run "npm install" after making the change – hamboy Feb 19 '21 at 21:11
20

I had the same error after upgrading node to v10.16.0

I ran the following which solved my issue:

rm -rf node_modules
rm package-lock.json
npm cache clean --force
npm install 

After closer inspection, it would seem that the generated tree in package-lock was outdated.

Luke Garrigan
  • 4,571
  • 1
  • 21
  • 29
17

I also faced the same problem and then I fixed by the following command:

npm install natives@1.1.6

May be helpful if someone having same issue. updating node to latest version requires above package.

MAhipal Singh
  • 4,745
  • 1
  • 42
  • 57
Dev-Learner
  • 171
  • 3
6

I recently ran into the same problem after installing node. Similar to @Dv-Learner answer, What fixed it for me was:

npm install natives@1.1.6
npm rebuild node-sass

the bit about rebuild node-sass was required for my machine (Windows)

EarlyCoder
  • 1,213
  • 2
  • 18
  • 42
2

@Student 22, in addition to Lloyd's solution, I simply updated my version to the most recent version for gulp using the command below ( Local Version 3.9.1 to Local Version 4.0.0) and I didn't run any additional commands.

npm install gulp-update

Reference: https://github.com/nodejs/node/issues/24985

Good luck!

2

In my case, I downgraded my node version from 10.16.0 to 8.11.4 which was required by my current project by this command

sudo n 8.11.4

Muhammad Awais
  • 1,608
  • 1
  • 21
  • 21
2

Had the same error. Solved it by installing graceful-fs.

It seems that natives package is now deprecatd and you should install graceful-fs instead.

I had node v10.16.1 and glup local version 3.9.1. I ran 'npm install graceful-fs' and glup no longer gave the error in this question. (Can't comment yet, so an answer).

Lupa
  • 81
  • 1
  • 11
0

Try this, it's working for me:

npm install -g graceful-fs graceful-fs@latest
LarsTech
  • 80,625
  • 14
  • 153
  • 225