question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gulp 3 is broken on Node 12

See original GitHub issue

What were you expecting to happen?

Gulp does anything useful

What actually happened?

Gulp throws the following error:

fs.js:27
const { Math, Object, Reflect } = primordials;
                                  ^

ReferenceError: primordials is not defined
    at fs.js:27:35
    at req_ (/tmp/node_modules/natives/index.js:143:24)
    at Object.req [as require] (/tmp/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/tmp/node_modules/gulp/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)

If using a TypeScript gulpfile with ts-node and typescript, the error looks like the following instead:

/tmp/node_modules/natives/index.js:143
    fn(internalBinding)(nm.exports, cachingRequire, nm, nm.filename, '<no dirname available>')
                       ^
ReferenceError: primordials is not defined
    at fs.js:27:35
    at req_ (/tmp/node_modules/natives/index.js:143:24)
    at Object.req [as require] (/tmp/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/tmp/node_modules/gulp/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)

Please post a sample of your gulpfile (preferably reduced to just the bit that’s not working)

This reproduces with an empty gulpfile

What version of gulp are you using?

3.9.1

What versions of npm and node are you using?

npm: 6.9.0 node: 12.0.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
phatedcommented, Apr 24, 2019

Gulp 3 is no longer supported.

1reaction
remilletcommented, May 1, 2019

Having the exact same problem. Using:

node: v12.1.0 npm: 6.9.0 gulp CLI version: 2.2.0 gulp Local version: 4.0.1

[exec] fs.js:27 [exec] const { Math, Object, Reflect } = primordials; [exec] ^ [exec] [exec] ReferenceError: primordials is not defined [exec] at fs.js:27:35 [exec] at req_ (/Users/remillet/dev/src/nuxeo/addons/nuxeo-platform-spreadsheet/nuxeo-platform-spreadsheet-web/src/main/js/node_modules/natives/index.js:143:24) [exec] at Object.req [as require] (/Users/remillet/dev/src/nuxeo/addons/nuxeo-platform-spreadsheet/nuxeo-platform-spreadsheet-web/src/main/js/node_modules/natives/index.js:55:10) [exec] at Object.<anonymous> (/Users/remillet/dev/src/nuxeo/addons/nuxeo-platform-spreadsheet/nuxeo-platform-spreadsheet-web/src/main/js/node_modules/graceful-fs/fs.js:1:37) [exec] at Module._compile (internal/modules/cjs/loader.js:759:30) [exec] at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10) [exec] at Module.load (internal/modules/cjs/loader.js:628:32) [exec] at Function.Module._load (internal/modules/cjs/loader.js:555:12) [exec] at Module.require (internal/modules/cjs/loader.js:666:19) [exec] at require (internal/modules/cjs/helpers.js:16:16)

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix "ReferenceError: primordials is not defined" in Node.js
Solution: Either upgrade to Gulp.js 4 or downgrade to an earlier version of Node.js. Share.
Read more >
Fix gulp 3 & node 12 compatibility issues - Raphael Ferrand
Turns out the issue is that Node 12 and Gulp 3 have compatibility issues. Upgrading Gulp version wasn't a solution at the time...
Read more >
primordials is not defined' error NPM/Gulp/JS - Renat Galyamov
Solution 1. A quick solution would be to downgrade the Node. I've found out that Node version 12 is compatible with Gulp version...
Read more >
How to fix "ReferenceError: primordials is not defined" error
How to fix "ReferenceError: primordials is not defined" error ... The thing is, gulp v3 doesn't work (as of now) under node v12...
Read more >
How to solve gulp exception: Reference Error primordials is ...
It seems that gulp v3 has a trouble when running on a Node.js 12 environment, because one of the dependencies, namely graceful-fs (a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found